# Making a purchase

#1

hi all i want to know what does this mean total += what does the (+=) mean and thank you

#2

Hi the += ...

``````#for example you a variable num
num = 2``````

and you want to add a number to the variable num you will do

``````num = num + 7

#Now num is equal to 9``````

which is the same as

``num += 7``

#3

oh thank you so much now i can understand it much better

#4

excuseme, actually there is something i want to say it's i can't understand any thing from A DAY AT THE SUPER MARKET it's very difficult please help .

#5

HI can you post your code or create a new topic with your code and a link to the lesson

#6

alright this is my code

``````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 += prices[item]
stock[item] = stock(item) - food[item]

what i realy want to understand is what or where is the variable which referes to the quantity of what the customer bought

#7

the problem is in this line:

``stock[item] = stock(item) - food[item]``

`stock(item)` is wrong, this would make it a function call, while you access a value for a dictionary which you do by using square brackets (`stock[item]`), which you do right earlier on this line

When the customer brought an item, you simply want to reduce the stock by one, not by the item.

If more help is required post an updated version of your code

#8

it worked thank you very very very much

#9