11. A day in the Supermarket, Making a Purchase


#1


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

The encoder displays a value of 4 and not 10.5, as is to be expected.


shopping_list = ["banana", "orange", "apple"]
    
    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(food):
        total = 0
        for key in food:
            total += prices[key]
            return total


#2

Remove four spaces of indentation so that the line matches up with for.

    for ...

    return total