Day at the supermarket help?


#1

I am having troubles with "a day at the supermarket, making a purchase" Can someone help me?
This is my current 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
}

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

It is returning 7.5 instead of 2 when "apple" is given as an input. How in world is that, and how can I fix it?


#2

replace: "for a in shopping_list:" to
"for a in food:"


#3

That worked. Thank you!