Advertisement
zhongnaomi

discount 3 while if elif else True

Jan 17th, 2019
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. finished = False
  2. while finished == False :
  3.     print("Hi, I am Marvin, your personal bot.")
  4.     command = input("How can I help? ")
  5.     if command == "calculate a discount for my basket":
  6.         shopping = []
  7.         R1 = input ( "How many items are in your basket ? ")
  8.         save = 0
  9.         for item_number in range(int(R1)):
  10.             item = input ( "What is the item " + str(item_number+1) + "  you wish to buy ? " )
  11.             shopping.append(item)
  12.             cost1= input ( "What is the list price of the item "  + str(item_number+1) + "  you wish to buy today ? " )
  13.             cost_off = input( " What is the percentage discount for item " + str(item_number+1) + "?" )
  14.             save = save + int(cost1)*(int(cost_off)/100)
  15.        
  16.        
  17.      
  18.         print ( "You will save  " + str(save) + " RMB. " )
  19.     elif command == "bye" :
  20.         finished = True
  21.     else :
  22.         print ("Sorry I do not understand this " )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement