Trouble with 10. Day at Supermarket, 9. Something of Value


#1

Hi, I have submitted the below code and receive the associated error message. Clearly I'm doing something wrong but I cannot figure it out! Thanks for any help you can provide.

 "Oops, try again. It looks like your code did not print the correct total."

I receive the following output in my window:

orange
price: 1.5
stock: 32
pear
price: 3
stock: 15
banana
price: 4
stock: 6
apple
price: 2
stock: 0
48.0
45
24
0
0
None


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:
    multiply = prices[key]*stock[key]
    print multiply

total = total + multiply
print total


#2

Hi @mihayes ,

In Python, indentation is important. Is this statement part of the for loop? ...

total = total + multiply

#3

That solved the issue. Indentation is definitely important! Thank you.


#4