Define a function named sum_values with two parameters. The first parameter will be a list of dictionaries (the data). The second parameter will be a string (a key). Return the sum of the dictionaries' values associated with the second parameter. You SHOULD NOT assume that all of the dictionaries in the first parameter will have the second parameter as a key. If none of the dictionaries have the second parameter as a key, your function should return 0. Sample function call: sum_values(data, 'estimated_annual_kwh_savings') sum_values_by_year

Answers

Answer 1

Answer:

Answered below

Explanation:

//Program is written in Python

sum = 0

def sum_of_values(dict_data, number_of_boys):

for dict in dict_data:

for key in dict.keys():

if key == number_of_boys:

sum += dict[key]

//After looping check the sum variable and //return the appropriate value.

if sum != 0:

return sum

elif sum == 0:

//There was no key of such so no addition.

return 0


Related Questions

Critiquing design: for each of these teapots , finish the statement last on the right that critique the object design

Answers

Answer:

Hey you have to add your own opinion. Like What you like about the teapot. what you wish was different. And What if meaning if it was changed how would it differ.

Explanation:

I like the design or this teapot. I wish it was made a little different. What if it was made different, it would be of more use and better to me.

please help
Consider the following code segment.

int a = 0;
int b = 3;

while ((b != 0) && ((a / b) >= 0)
{
a = a + 2;
b = b - 1;
}
What are the values of a and b after the while loop completes its execution?

a = 4, b = 1
a = 0, b = 3
a = 6, b = 0
a = 8, b = -1

Answers

Answer:

a = 6, b = 0

Explanation:

The loop ran 3 times before b == 0. The statement "while ((b != 0)" is essentially saying: 'While b is not equal to 0, do what's in my loop'. Same general thing with "&& ((a / b) >= 0)". The "&&" is specifying that there should be another loop condition. The final part of the while loop states: 'as long as a ÷ b is greater than 0, do what's in my loop'. If all of these conditions are met, the loop will run. It will continue to run until at least one of the conditions are not met.

Side note: I can't help but notice you posted the same question a while ago, so I just copied and pasted my previous response with some tweaking here and there. Hope this helps you! :)

please help me with this coding problem :)

Consider the following field and incomplete method of some class. The method calcTotal is intended to return the sum of all values in vals.

private int[] vals;

public int calcTotal()
{
int total = 0;

/* missing code */

return total;
}
Which of the code segments shown below can be used to replace /* missing code */ so that calcTotal will work as intended?

I.
for (int i : vals)
{
total += i;
}
II.
for (int pos = vals.length; pos > 0; pos--)
{
total += vals[pos];
}
III.
int pos = 0;
while (pos < vals.length)
{
total += vals[pos];
pos++;
}


I only
II only
I and III
II and III
III only

Answers

Answer:

ll and lll

Explanation:

list dont be a looser

The Binary Search algorithm works by testing a mid-point, then eliminating half of the list.

a. True
b. False

Answers

Answer:

a. True

Explanation:

The Binary Search algorithm works by testing a mid-point, then eliminating half of the list.

is the trust necessary to use an emerging technology platform? why?​

Answers

Answer:

Emerging technologies can provide improved accuracy, better quality and cost efficiencies for businesses in every sector. They can enhance trust in the organization's operations and financial processes, which is crucial for sustainable success.

Emerging technologies included a range of technology like education, IT, nanotechnology, biotech, computer neuroscience, robotic devices, and artifact intellectual ability.

It could working capital in all sectors with better accuracy, quality, and cost-efficiency.It can build confidence in the accounting and business processes of the organization, which is critical for sustainable success.

Therefore, these technical innovations represent the progressives of competitive advantage converging technologies, that in some ways represent bigger and more powerful interconnections and similar goals.

Learn more:

brainly.com/question/1144539

Which of the following statements is true for DMA: (only one correct answer) A. In DMA, Processor checks status until the operation is complete B. In DMA, Processor is interrupted when I/O module ready to execute data C. In DMA, no interrupt is produced D. In DMA, interrupt is sent when the task is completed E. None of the above

Answers

Answer:

D. In DMA, interrupt is sent when the task is completed

Explanation:

Note, the term Direct Memory Access simply refers to a computer feature that allows hardware subsystems to directly access the main system memory of a computer, without any the aid of the central processing unit (CPU).

It is a fact that while the transfer process is ongoing, an interrupt (interrupt signal) is not sent until when the task is completed.

The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dogBreed. Complete main() to:
• create a generic pet and print information using printInfo()
• create a Dog pet, use printInfo() to print information, and add a statement to print the dog's breed using the getBreed() method.
Ex. If the input is:
Dobby
2
Kreacher
3
German
Schnauzer
the output is:
Pet Information:
Name: Dobby
Age: 2
Pet Information:
Name: Kreacher
Age: 3
Breed: German Schnauzer

Answers

Answer:

Explanation:

The following code is written in Java and creates the needed code within the main method in order to get the desired output as shown in the example. It also added The proper questions so that the user can know what type of information they should type in.

import java.util.Scanner;

public class PetInformation {

   public static void main(String[] args) {

       Scanner scnr = new Scanner(System.in);

       String petName, dogName;

       String dogBreed = "null";

       int petAge, dogAge;

       Pet myPet = new Pet();

       System.out.println("Enter Pet Name:");

       petName = scnr.nextLine();

       System.out.println("Enter Pet Age:");

       petAge = scnr.nextInt();

       Dog myDog = new Dog();

       System.out.println("Enter Dog Name:");

       dogName = scnr.next();

       System.out.println("Enter Dog Age:");

       dogAge = scnr.nextInt();

       scnr.nextLine();

       System.out.println("Enter Dog Breed:");

       dogBreed = scnr.nextLine();

       System.out.println(" ");

       myPet.setName(petName);

       myPet.setAge(petAge);

       myPet.printInfo();

       myDog.setName(dogName);

       myDog.setAge(dogAge);

       myDog.setBreed(dogBreed);

       myDog.printInfo();

       System.out.println(" Breed: " + myDog.getBreed());

   }

}

class Pet {

   protected String petName;

   protected int petAge;

   public void setName(String userName) {

       petName = userName;

   }

   public String getName() {

       return petName;

   }

   public void setAge(int userAge) {

       petAge = userAge;

   }

   public int getAge() {

       return petAge;

   }

   public void printInfo() {

       System.out.println("Pet Information: ");

       System.out.println(" Name: " + petName);

       System.out.println(" Age: " + petAge);

   }

}

class Dog extends Pet {

   private String dogBreed;

   public void setBreed(String userBreed) {

       dogBreed = userBreed;

   }

   public String getBreed() {

       return dogBreed;

   }

}

Peyton is taking a part-time job to earn some extra money. Every week the manager will provide a list of tasks and the number of hours each task requires. The tasks have to be done one by one from the first one and Peyton would do so until the time spent on all finished tasks exceeds 10 hours. Please construct a function take_tasks, which takes one integer list as the argument task_hours and prints out how many hours and how many tasks Peyton would do for that week. For example, the program below
tasks ([2, 1, 3, 1, 4, 2, 3])
will have the following output:
Finish 5 tasks in 11 hours
Note: you can use enumerate() to get the index of the task, which is available after the for loop terminates. However, keep in mind that index starts from 0.
time_spent = 0
time_spent = 10
if time_spent > 10: break
if time_spent > 0: break
for index, hour in task_hours:
print('Finish {} tasks in {} he
if time_spent == 10: break
def take_tasks (task_hours):
time_spent += index
time_spent += hour
for index, hour in enumerate

Answers

Answer:

The function is as follows:

def tasks(Petyontasks):

   timespent = 0

   for i, tsk in enumerate(Petyontasks):

       if timespent<=10:

           timespent+=tsk

       else:

           break

   print("Finish "+str(i)+" tasks in "+str(timespent)+" hours")

Explanation:

The program in the question cannot be traced. Hence, the need to begin from scratch.

This defines the function

def tasks(Petyontasks):

This initializes timespent to 0

   timespent = 0

This iterates through the tasks [i represents the count of the tasks while tsk represents the time on each task]

   for i, tsk in enumerate(Petyontasks):

If timespent is less or equal to 10

       if timespent<=10:

The tasks is added and the timespent is calculated

           timespent+=tsk

If otherwise

       else:

The loop is exited

           break

This prints the required output

   print("Finish "+str(i)+" tasks in "+str(timespent)+" hours")

During what stage of problem solving is information gathered in order to see if the plan produced the intended outcome?
A. implement the solution
B. Define the problem
C. Identify solutions
D. evaluate results ​

Answers

Identify solutions is  to see if the plan produced the intended outcome.

Hence, option C is correct answer.

What is problem solving?

Diagnose the circumstance to keep your attention on the issue and not merely its symptoms. Use cause-and-effect diagrams to establish and examine root causes, and flowcharts to show the anticipated steps of a process while solving problems.

Key problem-solving steps are explained in the sections that follow. These actions encourage the participation of interested parties, the use of factual information, the comparison of expectations with reality, and the concentration on a problem's underlying causes. You ought to start by:

reviewing and capturing the functioning of current processes (i.e., who does what, with what information, using what tools, communicating with what organisations and individuals, in what time frame, using what format).

assessing the potential effects of new resources and updated regulations on the creation of your "what should be"

Read more about problem solving:

https://brainly.com/question/23945932

#SPJ1

A personal business letter may be written by ?

Answers

Answer:

a college student inquiring about a loan.

Explanation:

Why must a mobile application be easily customized and personalized?

Answers

Answer:

Explanation:

An app is a way to bring your consumer closer to your products or services. It allows customers to easily interact and make transactions without physical limitations. To have positive results, it's important that the app has a focus on user usability and navigability.

Answer:

I don't know Roxy -w-

Explanation:

examples of intermediate technology​

Answers

Example of intermediate technology is the treadle pump, which enables farmers to provide a greater amount of water to their plants more easily compared to watering by bucket, while requiring much less infrastructure than constructing irrigation dams and pipes.

third mean between two numbers 27 and 1 by 27 is 1 find the number of means​

Answers

Answer:

third mean between two numbers 27 and 1 by 27 is 1 find the number of means​

Explanation:

When it comes to paying bills at restaurants, Wallace always leaves a 15% tip based on the pretax price. However, Wallace is tired of computing tips every time, please construct a function total_bill, which takes a numerical argument pretax and returns the total bill by 1) calculating the tip, 2) the after-tax price, and 3) adding the tip to the after-tax price. Assume the sale tax is 9%. Below is how the function would be used:
pretax = 15
print('The total bill is ${}'.format(total_bill(pretax)))
The output should be:
The total bill is $18.6

Answers

Answer:

where are the answers.

Explanation:

Select the correct word to complete the sentence.
Bandwidth represents the _____ of a connection.

capacity
speed
distance
security

Answers

Distance is the answer!

Answer:

Capacity

Explanation:

i got it wrong and it showed this to be the answer on edge

3.5.6 Introduce Yourself, Part 2


please hellllpp it keeps saying the code is wrong

Answers

Answer:

In Python:

name = "Arthur"

age = "62"

print("Hi! My name is "+name+" and I am "+age+" years old")

Explanation:

Given

See attachment

Required

Write a code to introduce yourself

Initialize name

name = "Arthur"

Initialize age

age = "62"

Print introduction

print("Hi! My name is "+name+" and I am "+age+" years old")

Insert the following formula into Excel sheet. Cos A+ |23|​

Answers

=cos(A1)+abs(23)

Thank you hope this helps

Write a program that has the user input how many classes they are taking this semester and then output how many hours they will need to study each week. Assume that they need to study five hours per week for each class that they take.

Answers

This is for Python

class_amt = int(input('Amount of Classes: '))

hours = class_amt * 5

print(f'You need to study for {hours} hours every week')

The program that has the user input on how many classes they are taking this semester is written in python.

What is programming?

Writing code to support certain activities in a computer, application, or software program and giving them instructions on how to do is known as computer programming.

It is well known that one of the hardest subjects to master is programming. It is not difficult to understand why some people find it challenging to learn how to code given how different it is from conventional educational methods, including college degrees in computer science. In general, programming is a calm profession.

class_amt = int(input('Amount of Classes: '))

hours = class_amt * 5

print(f'You need to study for {hours} hours every week')

Therefore, the codes are written above.

To learn more about programming, refer to the link:

https://brainly.com/question/16850850

#SPJ2

3. Carmen Villa runs a cooking blog, where she posts a new recipe each day. She wants to get a sense
of where her visitors are from, so she can choose recipes from the areas where her website visitors
live. What other site usage information might she be able to gather, and how can she use it to
improve the cooking blog for her visitors?

Answers

Answer:

im kinda confused on this question is ther a answer key

Explanation:

If you get your foot stuck in a cloud how many colors can you smell with you ears

Answers

Answer: 42 is the answer to everything and just remember, Don,t panic.

For i am the hitch hikers guide to the galaxy.

 

Explanation:

The method removeDupes is intended to remove duplicates from array a, returning n, the number of elements in a after duplicates have been removed. For example, if array a has the values {4, 7, 11, 4, 9, 5, 11, 7, 3, 5} before removeDupes is called, then after duplicates are removed, a will be {4, 7, 11, 5, 9, 3} and 6 will be returned.Consider the following three implementations of RemoveDupes. I. public static int removeDupes (int [ 1 a) int n-a.length; for (int i-0, icn; i+M int current- a [il: int j i+1; while (jcn)K if (currentaulK alil aln-1) return n; Il. public static int removeDupes (int [] a)t int n-a.length; for (int i-0; ikn; i++ int current a [il for (int j-0; j

Answers

Answer:

public int removeDupes(int[]a){

int n =0;

for(int x =0;x<a.length;x++){

for(int y=0;y<a.length;y++){

if(a[x]==a[y]){

n++;

}

}

int left = a.length-n;

return left;

}

}

Explanation:

What can you think of as a box or container that holds a value and has a label?
a conditional
b variable
c algorithm
d paradigm​

Answers

Answer:

I think its B

Explanation:

none of the answers make that much sense to me but i did the quiz and that was what it was.

Answer:its b

Explanation:

Which one is better AMD Ryzen 5 Or Nvidia Gtx 2080 ti

Answers

Answer:

The NVIDIA GTX 2030 Ti

Explanation:

The AMD Ryzen 5 is good for a starting gaming PC, but if you are looking for a gaming PC that could run a lot more games, use the NVIDIA GTX 2080 Ti.

Create two functions (with appropriate names) that produce the output below. Both functions must use a prototype. All that should be present in main() is the call to these two functions and a blank line of output between the function calls. This is a very easy exercise. Focus on the fundamentals. Make sure you review my solution file to make sure your syntax and name choice is good. Output: This is the first part of my program. It was created with a function. <-- These two lines are output by the first function This is the second part of my program. It was created with a different function. <-- These two lines are output by the second function

Answers

Answer:

In C++:

#include <iostream>

using namespace std;

void function1(); void function2();

int main(){

   function1();    function2();

   return 0;}

void function1(){

   cout<<"This is the first part of my program."<<endl<<"It was created with a function"<<endl;}

void function2(){

   cout<<"This is the second part of my program."<<endl<<"It was created with a different function.";}

Explanation:

This defines the function prototypes

void function1(); void function2();

The main begins here

int main(){

This calls the two functions from main

   function1();    function2();

   return 0;}

This calls function1()

void function1(){

   cout<<"This is the first part of my program."<<endl<<"It was created with a function"<<endl;}

This calls function2()

void function2(){

   cout<<"This is the second part of my program."<<endl<<"It was created with a different function.";}


10. List three adaptations of wind-pollinated plants to promote pollination.

Answers

Answer:

No bright colors, special odors, or nectar.

Small.

Most have no petals.

An entrepreneur wants to make an app to show what breeds of dogs are similar to each other. She wants to look at factors such as weight and energy level in her comparison. In the end, she wants each breed of dog to belong to a certain category based on these characteristics. What would be a sensible approach to solving this problem using clustering?

Answers

Answer

Dog breeds = observations, Average weight and energy level for each breed = variables. Each cluster is a category.

Explanation:

Using a method of clustering, she would be putting the dog breeds that are more similar together and in order to do this she has to look at various factors such as observation which are the dog breeds, and the average weight and energy level of the breeds, which represents variables. Every one of these clusters would be a category.

What is THE GRAIN CRUSHER? ​

Answers

Answer:

Grain crusher is used to crush various kinds of grains, peas, buckwheat, beans, corn, linseed seeds and etc. Crushed grains are usually used to feed ruminant animals. Crushed grain are easier to digest, nutrients are assimilated more easily. Suitable as simply pellets chrusher.

Read the scenario and then choose which type of report it describes.

A salesperson searches the inventory list to find out whether a specific product is in stock.

customer list

market-research report

product list

sales-volume report

Answers

Answer:

C) product list

Explanation:

i read the coments above XD

plus im takeing the test rn

Answer:

Next one D

Explanation:

01110100 01101000 01101001 01110011 00100000 01110011 01110101 01100011 01101011 01110011 00100000 01100010 01100001 01101100 01101100 01110011 00100000 01110101 00100000 01100010 01101001 01110100 01100011 01101000 01100101 01110011

Answers

Answer:

01110101 01101110 01101111 00100000 01110010 01100101 01110110 01100101 01110010 01110011 01100101 00100000 01100011 01100001 01110010 01100100 00100000 01000010 01000101 01010100 01000011 01001000

How do most benchmark tests measure the performance of a graphic card​

Answers

Answer:

Using Frame Rate

Explanation:

Most benchmark tests measure the performance of a graphic card​ by using "Frame Rate"

This is because using Frame Rate assesses and then measures the number of images a GPU (graphic processing unit) can render and at the same time the number of images that are being shown on a monitor or screen per second.

Hence, in this case, the correct answer is "Frame Rate"

Other Questions
An article begins with excerpts from medical reports about the effects of steroids on the human body. It concludes with an essay by a once-promising football player who destroyed his health with steroids.What is most likely the authors purpose in writing this article?Select one:to entertainto persuadeto expressto describe The authors say, "There are a few seemingly simpleprotections against online predators." What ideado the authors convey through the use of the wordseemingly?a These protections don't actually exist.b Implementing these protections is more complicatedthan it first appears.Most people do not know about these protections.d The problem of online predators will be solved soon.stic Inc grants teacher subscribers to The New York Times Uplront pa In what year did William Hershel stroll the beach on English coast?QUICK THIS IS TIMED PLEASE HELP ME 3/7 of the students in a school are in sixth grade. a) How many sixth graders are there if the school has 70 students? 7 b) How many sixth graders are there if the school has 28 students? What should be the primary objective of managers? Pick 3 safety rules in science that you think are important and explain what would happen if the rules were no followed. Used your own word. Benedict Arnold one of America's best generals betrayed his country and joined the British. true or false Kaylee works at Claire's Jewelry Store at the mall. She earns $7.75 per hour. She earned $93.00 over the weekend. Her final check for the week was $232.50 (before deductions). How many hours did she work in addition to the weekend hours? On Monday, Caroline owed her Mom $350, she was able to pay back $200. Then she spent $23 for gasoline. She returned a sweater to Target and received a refund of $35. Then she spent $15 at the bookstore. Write one number sentence to show what happened on Monday. Then calculate how much money Caroline has now. 3 fewer than 5 times a number is 17 WHAT ARE ALL PRIME NUMBERS X WHICH ARE [tex]5\ \textless \ x\leq 19[/tex]WHOEVER ANSWERS FIRST AND CORRECTLY IS BRAINLIEST I willl mark you branlist!! Katelyn (55 kg) is practicing a drop jump in the biomechanics lab. She steps off a plyometrics box, lands on the force plate, and immediately jumps back up into the air. Right before she hits the force plate, her vertical velocity is 3.0 m/s downwards. After leaving the ground again, her vertical velocity is 3.5 m/s upwards. Katelyn was in contact with the ground for 0.4 seconds. (a) What was the impulse exerted on Katelyn when she was on the force plate WILL GIVE BRAINLIEST (35 POINTS)1-8 QUESTION fill the blanks in with ser estarBueno, mama,______muy tarde. Maana voy a ____________muy ocupada y necesito dormir. Pero sabes ahora que todo_______bien aqu y que yo __________contenta. Besos para ti y para pap. Un abrazo, Rosaura0 Joe and John have Repair shops. Joe charges $11.25 per hour for repairs. The table below show's John's rate: Who earns more money per hour? How much more money does that person charge per hour? Follow the steps to find the common denominators for 2/3 and 1/5 find the value of given expression[tex] \sqrt{900} [/tex] What is a dynamic character? A) a character who blows up B) a character who reacts with anger C) an aggressive character D) a character who grows and changes ANYONE WHO KNOWS SPANISH PLEASE HELPPLEASSEE