In this problem, you should write one function named count_calories
.
This function should have one parameter, which will be a dictionary 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':280})
should return 600.count_calories({'carrot':5, 'apple':50})
should return 55.Make sure to include only the one function in your file.
The gradescope tests will call the functions to test them.
Name the program prep28.py
.
Make sure that gradescope gives you the points for passing the test case.