Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ Python ] Define a function called print _ menu that will print the daily menu. It should be reusable enough to print any of

[Python] Define a function called print_menu that will print the daily menu. It should be reusable enough to print any of daily menus when called--not just Monday's.
FIrst:
Only Monday Menu is defined so far. The menu of five cookieswill change daily.
monday_menu ={'choccy chipper': {'price': 2.50, 'stock': 120},
'fudgy pudgy': {'price': 2.50, 'stock': 120},
'key lime crime': {'price': 4.25, 'stock': 96},
'salty sailor': {'price': 4.40, 'stock': 60},
'blueberry blooper': {'price': 5.00, 'stock': 60}}
Second:
We have created a for loop iterate over the monday_menu dictionary to print each cookie and it's price.
for x, y in monday_menu.items():
print(f"{x}: ${y['price']}")
Third:
We are allowed to call today's date by enter the code:
datetime.date.today()
What element from the above tasks did I have to modify for my function to be reusable across a variety of daily menus?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions