Error in compute_bill function


#1



https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/2/3?curriculum_id=4f89dab3d788890003000096

Whenever I enter my code, it shows an error message with some random combination of numbers which the function computes incorrectly.

It is supposed to calculate the price for the food taking in account the stock, but it does not do that. It just shows the error message. Please help if you can!

Here is the code I am using for the function.

Any help would be greatly appreciated!
Thanks,
Some coding apprentice who can't figure out this problem of his

def compute_bill(food):
    total = 0
    for key in food:
        if key(stock) > 0:
            total = total + prices[key]
        else:
            total = total + 0
    return total
    stock[key] = stock[key] - 1


#2

        if stock[key] > 0:
            total += prices[key]
            stock[key] -= 1
# not needed
    else:
        total = total + 0

#3

Thank you! This will help very much!