Projects/ShoppingCartProgram.py

25 lines
451 B
Python

# 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}')