Projects/concession_stand.py

33 lines
690 B
Python

# Concession Stand Program
menu = {"pizza": 1.50,
"soda": 2.00,
"popcorn": 6.00,
"pretzel": 2.50,
"candy bar": 0.90,
"hotdog": 2.75}
cart = []
total = 0
print("------------ MENU------------ ")
for key, value in menu.items():
print(f"{key:15} ${value:.2f}")
print("------------------------------")
while True:
food = input("Select items from the menu (q to quit) ").lower()
if food == 'q':
break
elif menu.get(food) is not None:
cart.append(food)
print()
print("------------CART------------- ")
for food in cart:
print(food, end=" ")
total += menu.get(food)
print(f"\nYour total: ${total:.2f}")