# Making a Purchase 11

#1

It tells me this...

Oops, try again. compute_bill(['apple']) returned 4 instead of 2

and the console thing says none please help thank you

``````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 food in shopping_list:
total += prices[food]

#2

def compute_bill(food):
total = 0
for food in shopping_list:
total += prices[food]

Should be:
def compute_bill(food):
total = 0
for item in food:
total += prices[item]

It says "none" because you haven't told it to print anything

#3

you are very close the issue is with your return total it should be indented the same amount as the for loop. as you have the for loop written now it ends the loop with return the first time it runs. here's how it should look, notice how my return total is lined up with my for loop.

``````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 item in food:
total += prices[item]