Something of value


#1

Oops, try again. It looks like your code did not print the correct total.prices = {
I do not understand what I am doing wrong.Some assistance would be appreciated. Thank you.

"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 total+ prices[key] * stock[key]
print total


#2

in your last for loop you need a statement that will keep a running total of the cost each time you are adding an item.

Without giving it away it will look like:

total += total + something[here] * something[here]

Then go ahead and print total


#3

I'm sorry.

Should be

total += something[here] * something[here]


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.