Can't figure out how to add the stock value to the variable total


I can't figure out how to add the total of goods to the variable total and print it. I get the error that I am not receiving the right value for total. I took out the code I wrote to try to add the stock worth to the variable total.

Wanting the total amount of stock worth to the variable total.

prices = {
    "banana" : 4,
    "apple"  : 2,
    "orange" : 1.5,
    "pear"   : 3,
stock = {
    "banana" : 6,
    "apple"  : 0,
    "orange" : 32,
    "pear"   : 15,

for key in prices:
    print key 
    print "price: %s" % prices[key]
    print "stock: %s" % stock[key]
total == 0

for key in prices:
   print prices[key] * stock[key] 
   total + prices[key] * stock[key]
print total


lets start on this line:

total == 0

we want to set total to 0, so we should a single equal sign (single = assign value to variable, two equal signs is compare)

Then we to update the total on this line:

total + prices[key] * stock[key]

currently you are just doing some math, how do we update the total? By adding prices * stock + total, like so:

total = total + prices[key] * stock[key]

now, this might seem weird, but you want add the price * stock + the old price, and store this in a updated total. Does this make sense?

Lets look at an example:

i = 3
i = i + 3

so, we are updating i here: i + 3, so i is 3, then you add 3 more, then you have 6, and this then gets store in i, which will overwrite the old i, so now i is 6