# A Day at the Super Market

#1

HELP PLEASE! I'm stuck and i don't know what to do

11.Making Purchase

It shows that Oops, try again. compute_bill(['apple']) returned 10.5 instead of 2

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

#2

``def compute_bill(food):``

the function parameter food will hold a list of items you want to buy, so you might want to re-think your loop

#3

should i replace food with shopping_list

#4

not really, look:

``````def compute_bill(food):
print food

# function call, remove to pass the exercise
compute_bill(shopping_list)``````

see how the argument (shopping_list) we supply when calling the function is copied into the function parameter, so you should loop over food, this way, your function works for many lists you supply as argument

After are done, remove the function call, otherwise you can't pass the exercise

#5

experts in Python, please help me out.I am very new to python programming.Fortunately, data camp and codecademy helped me to reach this stage.I have been struggling with the following code.

``````def compute_bill(food):
total=0
for item in food:
if stock[item]>0:
total += prices[item]
stock[item]= stock[item]-1