1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Digiron [165]
3 years ago
6

In this problem, you should write one function named count_calories. This function should have one parameter, which will be a di

ctionary of food items. The keys will ne the name of a food item (such as 'granola' or 'steak'), and the value associated with each food will be the integer calorie amount for that food. The function should iterate through all of the foods and sum up the total calories, and then return that number. For example:
count_calories({'chocolate':200, 'milk':120, 'steak':250}) should return 570.
count_calories({'carrot':5, 'apple':50}) should return 55.
Make sure to include only the one function in your file.
Computers and Technology
1 answer:
Vikentia [17]3 years ago
8 0

Answer:

The function is as follows:

def count_calories(dictt):

   total = 0

   for keys, values in dictt.items():

       total+=values

   

   return total

Explanation:

This defines the function

def count_calories(dictt):

This initializes total to 0

   total = 0

This iterates through the dictionary

   for keys, values in dictt.items():

This adds the dictionary

       total+=values

This returns the calculated total    

   return total

You might be interested in
Consider an individual who wishes to ensure that their information remains secure and confidential, possibly to secure their per
EleoNora [17]

In terms of leaving evidence on the system,  their key concerns is their data protection and someone hacking into the system or reading their browsing history to use it against them.

<h3>What is system hack?</h3>

System hacking is a term that connote when a person or a computer user has a compromise between computer systems and software that tends to access the target computer and steal their information or others.

In terms of leaving evidence on the system,  their key concerns is their data protection and someone hacking into the system or reading their browsing history to use it against them as well as their privacy been exposed.

Learn more about system hack from

brainly.com/question/13068599

#SPJ1

7 0
2 years ago
1. Describe a system that would be dangerous if resistance were not a part of the circuit
Ivahew [28]
A bomb system. That might be pretty dangerous
5 0
3 years ago
Read 2 more answers
Which group on the Home Ribbon allows you to create bulleted and numbered lists in a PowerPoint presentation?
igomit [66]
You gotta do the paragraph group its that one
3 0
3 years ago
Read 2 more answers
Add the following line of code to the end of your script, replacing any function calls: nested_sum( eval(input()) )
masha68 [24]

The program is an illustration of loops; Loops are program statements used for repetition of operations

<h3>How to complete the code?</h3>

The complete question is added as an attachment

The code written in Python that completes the missing parameters in the question are:

def nested_sum(mylist):

   total = 0

   for other_list in mylist:

       total += sum(other_list)        

   print(total)

   

t = [[1,2],[3],[4,5,6]]

nested_sum(t)

nested_sum( eval(input()))

Read more about loops at:

brainly.com/question/24833629

#SPJ11

8 0
2 years ago
(a) Draw a flow chart to a program that will have a servo arm move based on an input from a distance sensor. The sensor values w
Sveta_85 [38]

Answer:

c

Explanation:

got it right

6 0
3 years ago
Other questions:
  • Sample Run 1 Enter your word: zebras Enter a number: 62 Password not long enough. Sample Run 2 Enter your word: newyorkcity Ente
    12·1 answer
  • Why is it important to use standard english when applying for a job
    13·2 answers
  • Enter the value of 5⋅(13.5−4.5). <br> ​
    5·1 answer
  • You are the project manger for Xylophone Phonics. It produces children's software programs that teach basic reading and math ski
    11·1 answer
  • How many times will the while loop that follows be executed? var months = 5; var i = 1; while (i &lt; months) { futureValue = fu
    10·1 answer
  • What is Brainly?<br><br> A.Yes<br> B.No
    12·2 answers
  • Ryan has made a presentation of ten slides, which he wants to display in sequence after a specific time interval. Which element
    5·1 answer
  • NEED HELP WILL MARK BRAINLIEST AND 100 POINTS FOR ANSWER Which LIKE operator would match a single character?
    9·2 answers
  • SmartArt is especially useful for which types of objects? Check all that apply.
    10·2 answers
  • Multiple Choice
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!