Adding concession_stand.py
This commit is contained in:
parent
66229a6155
commit
953d34767d
33
concession_stand.py
Normal file
33
concession_stand.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# 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}")
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user