11, reaching the end


def compute_bill(food):
    total = 0
    for fruit in food:
        total += food[fruit]
    return total
my codes are above, and I think I have the same problem with you, which is prints the same number in the console, but the error still comes out as 
_Oops, try again. compute_bill(['apple']) resulted in a TypeError: list indices must be integers, not str_

but when I chang food[fruit] to prices[fruit], it works well.

I was quite confused about the difference between these two code. Can anyone have an answer for this?

Continuing the discussion from 11: Making a Purchase Question:


The lesson description says you need to compute the total cost of the items (via memory). You need the price of an item, so you should use the price array.

That's why prices[fruit] works.