Making a Purchase Good! Now you're going to need to know how much you’re paying for all of the items on your grocery list. def sum(numbers): total = 0 for number in numbers: total += number return total n = [1, 2, 5, 10, 13] print sum


Is there any thing wrong in my code.

def compute_bill(food):
total = 0
for value in food:
total += value
return total


You have to add up the prices, so instead of "+= value" try accessing your prices dictionary using value as the key


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.