Not working TOTAL


#1

Hi to All!
Why that code didn't work? It's work but not aproved.

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

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

print  total

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

Total counted normal, but I see "Oops, try again. It looks like your code did not print the correct total."


#2

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