Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Ask how many items of shopping are needed
- shopping = []
- how_many = input ("How many items of shopping do you have?")
- how_many = int(how_many)
- total = 0
- #Collect items and store in a list/ loop/ and print items
- for item_number in range(how_many):
- item = input("what is the item number" + str(item_number) + "?")
- shopping.append(item)
- print (shopping)
- print ("Now lets calculate how much it will cost you")
- total_cost = 0
- for item in shopping:
- item_cost=input("how much is the item " + item)
- total_cost=total_cost+float(item_cost)
- print("the total cost of your shopping is $" + str(total_cost))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement