Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. #Maggie_Potts_A8.py
  2. #Assignment 8 Amazin.com Shopping 2.0
  3.  
  4. #wrap in while loop for more carts
  5. #use list or tuple to translate menu item into price
  6. #end by asking for more carts
  7. #subtract -1 for list selection
  8. # [['origin', 19.95],['Grant', 24.50],['Prarie Fires', 18.95]] do list of lists for better prep for A9
  9. #Append these items to the cart list ^
  10. # cart = []
  11.  
  12.  
  13.  
  14. def transaction():
  15.  
  16. cats =["Books","Electronics","Clothing"]
  17. cart = []
  18. emptycart = [0,0,0]
  19. startcost = [0,0,0]
  20.  
  21. books = [19.95,24.50,18.95]
  22. electronics = [429,790,220]
  23. clothing = [9.50,45,24]
  24.  
  25. menu = ("""
  26. 1 - Books
  27. 2 - Electronics
  28. 3 - Clothing
  29. 4 - Checkout
  30.  
  31. Select one of the categories or checkout (1-3 or 'c'):
  32. """)
  33.  
  34. while True:
  35.  
  36. print(menu)
  37. selection = int(input())
  38.  
  39. if selection == 1:
  40. print("1. Origin, $19.95")
  41. print("2. Grant, $24.50")
  42. print("3. Prairie Fries, $18.95")
  43. print("4. No Selection")
  44. print("\n Select a title or select 4 for no selection (1-4): ")
  45.  
  46. sel2 = int(input())
  47.  
  48. if sel2 >= 1 and sel2 <= 3:
  49. emptycart[1] += 1
  50. startcost[0] += books[sel2-1]
  51.  
  52.  
  53. elif selection == 2:
  54. print("1. Hp laptop, $429.50")
  55. print("2. EyePhone, $790.00")
  56. print("3. Bose 20 speakers, $220.00")
  57. print("4. No Selection")
  58. print("\n Select an electronic or select 4 for no selection (1-4): ")
  59.  
  60. sel2 = int(input())
  61.  
  62. if sel2 >=1 and sel2 <= 3:
  63. emptycart[1] += 1
  64. startcost[1] += electronics[sel2-1]
  65.  
  66. elif selection == 3:
  67. print("1. T-shirt, $9.50")
  68. print("2. Shoes, $45.00")
  69. print("3. Pants, $24.00")
  70. print("4. No Selection")
  71. print("\n Select a clothing item or select 4 for no selection (1-4): ")
  72.  
  73. sel2 = int(input())
  74.  
  75. if sel2 >=1 and sel2 <=3:
  76. emptycart[2] += 1
  77. startcost[2] += clothing[sel2-1]
  78.  
  79. if selection == 4:
  80. print("Checking Out...")
  81. break
  82.  
  83. transaction()
  84.  
  85. input("\n\nHit Enter to end program")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement