12.Stocking out...possible bug?


#1

Here's the code:

And when running it it shows this error message: Oops, try again. calling compute_bill with a list containing 1 apple, 1 pear and 1 banana resulted in 9 instead of the correct 7
But if we calculate this ourselves,the result is actually 9 (2+3+4). Explain me if i'm worng:D


#2

Read instructions carefully. Especially point 01. There is your answer.


#3

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