Question
Coffee shop menu python script: INSTRUCTIONS: # Use the for loop from above to print out a menu with # the coffee drink items. Depending
Coffee shop menu python script:
INSTRUCTIONS:
# Use the for loop from above to print out a menu with # the coffee drink items. Depending on the coffee names you use, # you may want to modify the placeholder for the product name # {:20} to be a different size width.
# Wrap the code displaying the menu into a function. # After the menu displays, prompt the user for a selection, # allowing them to enter a special value for no selection, # e.g. 0, validate that they've entered an allowable selection # (0 through 4), then have the function return that selection.
SCRIPT:
def get_menu_choice(): products = [["Mocha Frappe", 2.50], ["Caffe Macchiato", 4.00], ["Espresso", 3.00], ["Caramel Latte", 5.50]] for product in products: print("{}. ".format(products.index(product) + 1), end='') print("{:17}${:.2f}".format(product[0], product[1])) choice = input("Enter selection or 0 to quit") return choice
I need help modifying the code as I don't know what I am missing to make it do what is asked of it in the instructions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started