Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 hundreds, 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 itertoolss 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)

Please complete this question in Jupyter Notebook and run it to generate the result. Then upload your notebook using the "Insert" tab on the menu bar to upload your notebook with its running result. You can also copy and paste your code and its running result in the provided text area.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago