Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having issues with my Python Programming Assignment. For Q1.1, i'm confused as to how to do the step that says change the code

I am having issues with my Python Programming Assignment. For Q1.1, i'm confused as to how to do the step that says "change the code so that even if recipe_dict is modified, the recipes in menu_schedule should have no effects." I don't know where to go from here. Also for q1.2, i don't know how to do this question, having difficulty understanding where to start. attached is two images of the code doctests includijng part of my own code (it completes the first step of q1.1), and a link to a pdf of the explanations for Q1 as a whole. thanks!

https://drive.google.com/file/d/1WMHbinvjLpuYQvw64uhxR6Sq5cMxWInL/view?usp=sharing

image text in transcribed

image text in transcribed

# Question 1.1 # def populate_menu_schedule(menu_schedule, recipe_dict): Populate the given menu_schedule with recipes based on recipe_dict Parameters: menu schedule (tuple): A tuple with five dictionaries representing the menu recipe_dict (dict): A dictionary of food recipe Returns: (None) >>> menu_schedule = ( { "Orange Chicken": [], "Broccoli Beef": []}, {"Broccoli Beef": []}, { "Orange Chicken": [], "Spring Roll": []}, {"Fortune Cookie": []}, {"Fortune Cookie": [], "Broccoli Beef": []} >>> recipe_dict = { V "Orange Chicken": ["orange", "Chicken"), "Fortune Cookie": ["Fortune", "Cookie", "Paper"], "Spring Roll": ["Egg"] >>> populate_menu_schedule (menu_schedule, recipe_dict) >>> menu_schedule ({ 'Orange Chicken': [ 'orange', 'Chicken']}, {}, {'Orange Chicken': ['orange', 'Chicken'), 'Spring Roll': [ 'Egg']}, {'Fortune Cookie': ['Fortune', 'Cookie', 'Paper']}, {'Orange Chicken': [ 'Orange', 'Chicken']}) >>> menu_schedule[@]['Orange Chicken'].append("Hot Sauce") >>> menu_schedule[2]['Orange Chicken'] ['Orange', 'Chicken', 'Hot Sauce'] >>> menu_schedule[@]['Gyro Plate'] = ['Beef'] >>> menu_schedule[@] {'Orange Chicken': [ 'Orange', 'Chicken', 'Hot Sauce'], 'Gyro Plate': ['Beef']} >>> menu_schedule[4] {'Orange Chicken': [ 'Orange', 'Chicken', 'Hot Sauce']}, for day in range(5): food 1st - list(menu_schedule[day].keys (0) for food in food_lst: if food in recipe_dict.keys(): menu_schedule[day][food) = menu_schedule[day][food] + recipe_dict[food] else: del menu_schedule[day][food) ## Question 1.2 ** def dereference_recipes (menu_schedule): Dereference all pairs of recipe that refers to the same recipe object Parameters: menu_schedule (tuple): A tuple with five dictionaries representing the menu whose recipes have been already populated Returns: (none) >>> menu_schedule =( {"Orange Chicken": [], "Broccoli Beef": []}, {}, {}, {"orange Chicken": [], "Broccoli Beef": []} >>> Oc_recipe = ['Orange', 'Chicken'] >>> bb_recipe = ['Love'] >>> menu_schedule[@]["Orange Chicken"] = oc_recipe >>> menu_schedule[4]["Orange Chicken"] = Oc_recipe >>> menu_schedule[@]["Broccoli Beef"] = bb_recipe >>> menu_schedule[4]["Broccoli Beef"] = bb_recipe >>> menu_schedule[4][ "Broccoli Beef"].append('Peace' >>> dereference_recipes (menu_schedule) >>> menu schedule 4 "Broccoli Beef").remove("Peace') >>> menu_schedule[@]["Broccoli Beef"] ['Love', 'Peace'] # YOUR CODE STARTS HERE #

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago