12/13 Help me, I'm stuck


#1

I cannot complete this exercise because it gives me this error:

Oops, try again. calling compute_bill with a list containing 1 apple, 1 pear and 1 banana resulted in 9 instead of the correct 7

My code

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

The total of 1 apple,1 pear and 1 banana is 9 and if I try to change it I get this error instead:

Oops, try again. prices doesn't look quite right! It should contain: {'orange': 1.5, 'pear': 3, 'banana': 4, 'apple': 2}


#2

Nevermind, I forgot to check if it was in stock first.