Aequitas35

shopping.develop

Oct 17th, 2018
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. how_many = input("How many items do you want to buy? : ")
  2.     shopping = []
  3.     total = 0
  4.     for item_count in range(int(how_many)):
  5.         item = input("What is the item " + str(item_count) + " you want? : ")
  6.         price = float(input("What is the price for this item? : "))
  7.         if price != float():
  8.             print("Please enter numbers, instead of letters")
  9.             price = float(input("What is the price for this item? : "))
  10.         shopping.append(item)
  11.         total = total + price
  12.  
  13.     print()
  14.     for item in shopping:
  15.         print(item)
  16.     if int(how_many) > 1:
  17.         print("You have " + str(len(shopping)) + " items in your shopping list.\nTotal price of these items are " + str(total) + " $")
  18.     else:
  19.         print("You have " + str(len(shopping)) + " item in your shopping list.\nTotal price of these items are " + str(total) + " $")
Advertisement
Add Comment
Please, Sign In to add comment