Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Wasted Food Responsible Coding Function Name: wasted_food() Parameters: a list of a list and tuples Returns: least wasteful food and percent waste (tuple ) Description:

image text in transcribed

Wasted Food Responsible Coding Function Name: wasted_food() Parameters: a list of a list and tuples Returns: least wasteful food and percent waste (tuple ) Description: Georgia Tech dining has noticed that some meals have been producing more leftovers than others. They want to figure out what meals students prefer, so that more food is not wasted. Write a function that takes in a list of one list with meals, followed by tuples co- ordinated to each meal in the list, formatted as: [ [meal name 1, meal name 2, etc), (meal 1 lbs of food purchased, meal 1 lbs of food left over), (meal 2 lbs of food purchased, meal 2 lbs of food left over), etc) This function should find the percent of food wasted and return a tuple with the meal that is least wasteful and its percent waste rounded to 2 decimal places. If two meals have the same percent waste, return the meal that has the least amount of leftovers. No two meals will have the same amount of leftovers. >>> foods = [["Chicken Parmesan", "Spaghetti", "Cheeseburger"), (545, 86), (462 200), (620, 107)] >>> print (wasted_food(foods)) ('Chicken Parmesan', 15.78) >>> foods = [("Pizza", "Sandwiches"), (702, 156), (490, 100)] >>> print (wasted_food(foods)) ('Sandwiches', 20.41)

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions