Hey there. I’m having trouble understanding why this is different from the example.
Looking at the example I wrote out
def compute_bill(food): total = 0 for item in food: total+= item return total
Which, as we know, is not the right answer. But when I look at the correct code…
def compute_bill(food): total = 0 for item in food: total+= prices[item] return total
…there seems to be a disconnect between prices and the variable food. How do we go from taking the item in food to the item in prices? The example used a list, but prices is a dictionary. Does that have anything to do with it?