Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a coding problem in my beginner python class. I have learned up to tuples/tuplist. I do not know how to write code for

image text in transcribedThis is a coding problem in my beginner python class. I have learned up to tuples/tuplist. I do not know how to write code for each question. please help!

image text in transcribed

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)] Ancestors Function Name: ancestors() Parameters: list of names ( list ), surname ( str) Returns: matching names ( list ) Description: Seeing people participate in mail-in DNA ancestry tests lately, you have decided you want to participate, but you would rather save money and code your own test. Write a function that takes in a list of names and a specific surname to search for. Return a list of the first names of all the names in the original list that have the correct surname AND do not have middle names. There should be no repeats in the returned list. It should be case-sensitive ("Yap" is not the same surname as "yap"). >>> names = ["Damian Henry", "Henry Ford", "Warren Elliot Henry", "Heather Fren ch Henry"] >>> surname = "Henry" >>> print (ancestors (names, surname)) ['Damian'] >>> names = ["Kim Kardashian West", "Kylie Jenner", "Kourtney Mary Kardashian", "Jasmine Kardashian", "Brae Kardashian", "Jasmine Kardashain"] >>> surname = "Kardashian" >>> print (ancestors (names, surname)) ['Jasmine', 'Brae'] Summer Job Function Name: summer_job() Parameters: a list of job tuples ( list) Returns: highest paying job (str) Description: You are looking to find a job on campus for this summer to save money for a study abroad. Write a function that takes in a list of tuples in the format of (j hourly pay ( float ), hours per week (int)), and determines in which job you would make the most money weekly. If two jobs have the same weekly pay, return the job that appears first in the list. Assume that tax is already accounted for. Note: These numbers are not representative of the true salaries. >>> jobs = [("Teaching Assistant", 8.50, 12), ("Office of International Affairs ", 9, 8), ("CRC", 7.50, 15)] >>> print (summer_job(jobs)) "CRC' >>> jobs = [("Tour Guide", 15, 4), ("CULC Help Desk", 9.25, 10), ("Tutor", 8.00 , 7)] >>> print (summer_job (jobs)) 'CULC Help Desk

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

6x32x2 2x36x2 10

Answered: 1 week ago