Question: python Function Name: wasted_food() Parameters: a list of a list and tuples Returns: least wasteful food and percent waste ( tuple ) Description: university dining

python

python Function Name: wasted_food() Parameters: a list of a list and tuples

Function Name: wasted_food() Parameters: a list of a list and tuples Returns: least wasteful food and percent waste ( tuple ) Description: university 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 coordinated 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!