Error


#1

https://www.codecademy.com/en/courses/python-beginner-en-IZ9Ra/2/3?curriculum_id=4f89dab3d788890003000096


calling compute_bill with a list containing 1 apple, 1 pear and 1 banana resulted in 4 instead of the correct 7

shopping_list = ["apple", "pear", "banana"]

stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15
}
    
prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3
}

# Write your code below!
def compute_bill(shopping_list) :
    total = 0
    for fruit in shopping_list :
     if stock[fruit] != 0  :
        
            total += prices[fruit]
            stock[fruit] -= 1
            return total
            print "%s"%total

#2

A function stops running when it returns. Control of the program along with the result of the function is returned to the caller.