12 stock problem


#1

Hey folks,
def compute_bill(food):
total = 0
for item in food:
if stock[item]>0:
total += prices[item]
stock[item] = stock[item] - 1
return total

print(compute_bill(shopping_list))
print(stock)

I'm running this code but I get error message as follows:
Oops, try again. stock doesn't look quite right! Make sure to not call compute_bill since it changes the stock! It should contain: {'orange': 32, 'pear': 15, 'banana': 6, 'apple': 0}

I can't figure out the problem. Any suggestions?


#2

Read the error message and the instructions! They ask you not to call your function since it changes the stock and the code checker expects the stock to start with certain values.