Making a purchase


#1

What did I do wrong now.

Here is the error code.

Oops, try again.
compute_bill(['apple']) resulted in a NameError: global name 'key' is not defined

my code

shopping_list = ["banana", "orange", "apple"]

stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15
}
    
prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3
}

# Write your code below!
def compute_bill(food):
    total = 0
    for item in shopping_list:
        total += stock[key] * prices[key]
    return total

#2

indents are all good I checked twice


#6

 for key in shopping_list:
        total += stock[key] * prices[key]

#8