P
P
Python Classroom
K
Comment on page

# Shopping Project

## Problem

You want to go shopping for computers and electronics. Create two lists. One for the name of the items and other for the cost of the items.
• Create a menu item S that lists the items for sale and the cost
• Create a menu item P that asks the user for 3 items to purchase and their prices.
• Create a menu item C that print the items the user purchases and the total price.
• Create a menu item Q that quits the program.

## Example Code

shopping_list = []
shopping_cost = []
done = False
while not done:
print("Shopping Program")
print("S - Shop")
print("P - Purchase")
print("C - Checkout")
print("Q - Quit")
choice = input("Choice: ")
if choice == "S":
print("Items available to purchase")
print("Animal Crossing \$59.99")
print("Beats by Dr Dre \$199.99")
print("HP 15.6\" touchscreen laptop \$499.99")
print("ASUS 14\" touchscreen laptop \$599.99")
print("Samsung 13.3\" touchscreen laptop \$849.99")
print("HP ENVY x360 \$799.99")
elif choice == "P":
for x in range(3):
add_shopping_list = input("Name of Item: ")
add_shopping_cost = float(input("Cost of Item: "))
elif choice == "C":
print("Items Purchased")
for x in shopping_list:
print(x)
print("Total: ",sum(shopping_cost))
elif choice == "Q":
print("Quitting")
done = False
else:
print("Invalid Choice")