A Day at the Supermarket


#1

I have trouble at this stage. When I save & submit code, it keeps telling me "Oops, try again. calling compute_bill with a list containing 1 apple, 1 pear and 1 banana resulted in 4 instead of the correct 7 ". My code is below:

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

#2

a function ends the moment a return keyword is reached

change the indent of return so the whole for loop can run


#3

Problem solved. Thanks a lot!


#4