Code returns "Oops, try again. compute_bill(['banana', 'apple', 'orange', 'pear']) returned 8 instead of 10.5" when total +=prices[key]
When I change key to item, the code runs. I think it's because key is checking both dictionaries and referencing stock but the math should be 8.5, not 8 unless python was instructed to return an integer or just rounds down from 5.
What is the ELI5? Does item trigger an action or process or something I just don't understand yet?
def compute_bill(food): total = 0 for item in food: total += prices[item] return total