Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions