#9 a day at the supermarket


#1

I need some help with what to put at the line with the empty print statement. It says Print that value into the console and then add it to total. What do I put for the "value"? I hope this doesn't confuse anyone. Thanks!


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:
    prices * stock
    print 
    total = total + 
    
    
print total


#2

You could set a new variable for the multiplication component:
total = 0
for key in prices:
value = prices[key] * stock[key]
total = total + value

print total

or just write it as follows:
total = 0
for key in prices:
prices[key] * stock[key]
total = total + prices[key] * stock[key]

print total