Why is My Code Not Passed?


#1

Question about Making a Purchase

so below is the correct code (Codecademy only allows me to insert one image, lol)
def compute_bill(food):
total = 0
for items in food:
total+=prices[items]
return total

and here is mine:

WHY isn’t mine working?

Thanks in advance!


FAQ: Learn Python: A Day at the Supermarket - Making a Purchase
#2

what are the expected values for food?


#3

You might be able to answer that yourself by simply avoiding the term “working” - compare what you expected and what happens instead, the difference is what you need to change. There’s nothing stopping you from adding prints in your code so that you can find out what happens in there.