menu = {"burger": 3.99,
"fries": 1.99,
"drink": 0.99}
total = 0
#shows the user the menu and prompts them to select an item
print("Menu")
for k,v in menu.items():
print(k + " $" + str(v)) #why does v have "str" in front of it?
#ideally the code should prompt the user multiple times
item = input("Please select an item from the menu")
#code should add the price of the menu items selected by the user
print(total)
Menu
burger $3.99
fries $1.99
drink $0.99
0
menu = {
"burger": 3.99,
"fries": 1.99,
"drink": 0.99
}
total = 0
while True:
print("Menu")
for item, price in menu.items():
print(f"{item.capitalize()}: ${price:.2f}")
choice = input("Please select an item from the menu (or 'done' to finish): ").lower()
if choice == 'done':
break
if choice in menu:
total += menu[choice]
print(f"Added {choice} to your order. Total: ${total:.2f}")
else:
print("Invalid item. Please choose from the menu.")
print(f"Your total bill is: ${total:.2f}")
Menu
Burger: $3.99
Fries: $1.99
Drink: $0.99
Added burger to your order. Total: $3.99
Menu
Burger: $3.99
Fries: $1.99
Drink: $0.99
Your total bill is: $3.99