Course Hero Logo

shopping_cart_2.0.py - gadgets = select = 0 add_gadget = "...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 out of 1 page.

gadgets = []select = 0add_gadget = ""remove_gadget = ""gadget_price = []price = 0total = 0gadget_quantity = []quantity = ""print("Welcome to the shopping cart program!\n")print("Please select one of the following: ")print("1. Add gadgets\n2. View Cart\n3. Remove gadgets\n4. Compute total\n5. Quit")try:select = int(input("Please enter an action: "))except:print("Try numbers please")while select!= 5:if select == 1:add_gadget = input("what Gadget would you like to add? ")price = float(input(f"what is the price of {add_gadget} "))quantity = input(f"what is the quantity of {add_gadget} ")gadgets.append(add_gadget)gadget_price.append(price)gadget_quantity.append(quantity)print(f"'{add_gadget}' has been added to the cart.")elif select == 2:
End of preview. Want to read the entire page?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
NoProfessor
Tags
Following, Grammatical number, GADGET, Item number

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture