Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shopping =[]# The empty list MUST BE FIRST
- total_cost = [] # to store costs
- how_many = input ("How many items of shopping do you have? ")
- how_many = int (how_many) #REMEMBER this is how you change the string variable
- # and CAST it into an integer.
- for item_number in range (how_many):
- item = input ("What is the shopping item " + str (item_number) + "? ")
- cost = float(input ("How much does it cost" + str (item_number) + "£ "))
- shopping.append (item)
- total_cost.append (cost)
- print(shopping) # You can omit these lines once you're happy that the code works
- print(total_cost) # although I would want to keep the shopping list
- #for item_cost in range (cost_item):
- # item = input ("How much does it cost " + str(cost_item) + "? ")
- # shopping.append (cost)
- #print ("Your shopping total is" )
Advertisement
Add Comment
Please, Sign In to add comment