Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- how_many = input("How many items do you want to buy? : ")
- shopping = []
- total = 0
- for item_count in range(int(how_many)):
- item = input("What is the item " + str(item_count) + " you want? : ")
- price = float(input("What is the price for this item? : "))
- if price != float():
- print("Please enter numbers, instead of letters")
- price = float(input("What is the price for this item? : "))
- shopping.append(item)
- total = total + price
- print()
- for item in shopping:
- print(item)
- if int(how_many) > 1:
- print("You have " + str(len(shopping)) + " items in your shopping list.\nTotal price of these items are " + str(total) + " $")
- else:
- 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