Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Maggie_Potts_A8.py
- #Assignment 8 Amazin.com Shopping 2.0
- #wrap in while loop for more carts
- #use list or tuple to translate menu item into price
- #end by asking for more carts
- #subtract -1 for list selection
- # [['origin', 19.95],['Grant', 24.50],['Prarie Fires', 18.95]] do list of lists for better prep for A9
- #Append these items to the cart list ^
- # cart = []
- def transaction():
- cats =["Books","Electronics","Clothing"]
- cart = []
- emptycart = [0,0,0]
- startcost = [0,0,0]
- books = [19.95,24.50,18.95]
- electronics = [429,790,220]
- clothing = [9.50,45,24]
- menu = ("""
- 1 - Books
- 2 - Electronics
- 3 - Clothing
- 4 - Checkout
- Select one of the categories or checkout (1-3 or 'c'):
- """)
- while True:
- print(menu)
- selection = int(input())
- if selection == 1:
- print("1. Origin, $19.95")
- print("2. Grant, $24.50")
- print("3. Prairie Fries, $18.95")
- print("4. No Selection")
- print("\n Select a title or select 4 for no selection (1-4): ")
- sel2 = int(input())
- if sel2 >= 1 and sel2 <= 3:
- emptycart[1] += 1
- startcost[0] += books[sel2-1]
- elif selection == 2:
- print("1. Hp laptop, $429.50")
- print("2. EyePhone, $790.00")
- print("3. Bose 20 speakers, $220.00")
- print("4. No Selection")
- print("\n Select an electronic or select 4 for no selection (1-4): ")
- sel2 = int(input())
- if sel2 >=1 and sel2 <= 3:
- emptycart[1] += 1
- startcost[1] += electronics[sel2-1]
- elif selection == 3:
- print("1. T-shirt, $9.50")
- print("2. Shoes, $45.00")
- print("3. Pants, $24.00")
- print("4. No Selection")
- print("\n Select a clothing item or select 4 for no selection (1-4): ")
- sel2 = int(input())
- if sel2 >=1 and sel2 <=3:
- emptycart[2] += 1
- startcost[2] += clothing[sel2-1]
- if selection == 4:
- print("Checking Out...")
- break
- transaction()
- input("\n\nHit Enter to end program")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement