# total price accumulator total = 0 # ask the user for a number of products numprices = int(input("How many products did you buy? ")) # generate loop for i in range(1, numprices+1): # get price for this product p = float(input("Enter price for product # " + str(i) )) # add to accumulator total += p # output print ("Total cost of your products: ", total)