Question: undefined Write a Python class named Food constructed by name of food, quantity of servings of food, calory of one serving, a method which will
undefined
Write a Python class named Food constructed by name of food, quantity of servings of food, calory of one serving, a method which will set the food with specified name, quantity of servings and calory of one serving, a second method which returns the quantity of servings of food, and a third method which returns the total calory with consumption of the food. (30 pts) Next, create one hundred different foods with different names (please do not list all of the one hundred's, just give the code for the first two foods). Then use List comprehension to find the top three foods which have the most total calories and display their names, quantity of servings of food and total calory consumed. (10 pts) Lastly, use itertools's groupby() method to group the one hundred food by their calories of one serving into dictionaries, which will use calory of one serving as key, and list of foods as value (10 pts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
