12/13 I need some guidance


#1

When I run my code an error comes up saying "Oops, try again. calling compute_bill with a list containing 2 apples and 7 bananas resulted in 28 instead of the correct 24"
Here is my code
def compute_bill(food):
total = 0
for item in food:
if stock[item] > 0:
total += prices[item]
if stock[item] > 0:
stock[item] = stock[item] - 1
return total


#2

I just realized its because there is only 6 bananas in stock but shouldn't it stop adding the price of bananas to the total one the stock is zero


#3

Never mind I fixed it by taking out the second if statement