12.Stocking Out


#1

My code is going nowhere :frowning:

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

I get all the time the same message: Oops, try again. calling compute_bill with a list containing 1 apple, 1 pear and 1 banana resulted in 0 instead of the correct 7


#2

a function ends the moment a return keyword is reached, this is currently happening in the first iteration of your loop, change the indent of return so the whole for loop can run