Advertisement
zhongnaomi

add up the cost of shopping

Jan 10th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. print("Hi, I am Marvin, your personal bot.")
  2. command = input("How can I help? ")
  3. if command == "make a shopping list":
  4.     shopping = []
  5.    
  6.     R1 = input ( "How many items of shopping do you have? ")
  7.     i = 0
  8.     j = 0
  9.     for item_number in range(int(R1)):
  10.         item = input ( "What is the No." + str(item_number+1) + " item to buy today? " )
  11.         shopping.append(item)
  12.         i = i+1
  13.         cost_str= input( " How much is this ?" )
  14.         j = j + int(cost_str)
  15.        
  16.        
  17.    
  18.     count = 0    
  19.     print ("your shopping list items are :  " )
  20.     for item in shopping:
  21.         print(item)
  22.         count = count + 1
  23.    
  24.  
  25. print ("you have " + R1 + " items in your shopping list. Shopping will cost  " + str(j) + " RMB . " )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement