Adding ShoppingCartProgram.py
This commit is contained in:
parent
b1ad66d4f9
commit
66229a6155
25
ShoppingCartProgram.py
Normal file
25
ShoppingCartProgram.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Shopping Cart Program
|
||||||
|
|
||||||
|
foods = []
|
||||||
|
prices = []
|
||||||
|
total = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
|
food = input("Enter a food item (q to quit): ")
|
||||||
|
if food.lower() == 'q':
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
foods.append(food)
|
||||||
|
price = float(input("Enter a price $"))
|
||||||
|
prices.append(price)
|
||||||
|
total += price
|
||||||
|
|
||||||
|
print("----- YOUR CART ----")
|
||||||
|
for food in foods:
|
||||||
|
print(food)
|
||||||
|
|
||||||
|
print(f'\nYour total is: ${total}')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user