9/13 problem


#1

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 x in prices:
n = prices[x] * stock[x]
total = total + n

print total

Why does this not work?


#2

Hi @neoombra,

The problem might relate to the indentation of your code, however since your posted code is not formatted, that indentation is not visible to other users who may wish to offer help.

See Quick Tips for Writing Good Posts.


#3

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