Making a Purchase


Traceback (most recent call last):
File "python", line 25, in
File "python", line 21, in compute_bill
KeyError: 1

I'm stuck as I dont understand my mistake. Can you help me fix this?

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):
    for item in food:
    return total

print compute_bill(n)



print compute_bill(n)

when calling the function, supply shopping_list as argument, compute_bill is a function which calculates the bill from product (names) not numbers


Aha! Got it. Thank you.