# 12.Stocking Out

#1

The link I am on is the Stocking Out one, in the chapter "A Day at the Supermarket".

My error message is:" Oops, try again. calling compute_bill with a list containing 2 apples, 1 pear and 8 bananas resulted in 7 instead of the correct 27"

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

The thing is, I am not calling the function compute_bill like is mentioned in other posts on this chapter.

EDIT: Solved it by refreshing the page, it must be storing some cached data(?) and then changed my code a little bit. Simple the decrement of the stock to be -= 1.

#2

this line:

``stock[item] =-1``

the short hand to reduce a item by is `-=` not `=-`

#3

Ye I just did that and refreshed the page, it fixed it. Thank you mate.

#4