A Day at the Supermarket


#1

prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}

for i in prices:
print i
print "prices: %s" % prices[i]
print "stock: %s" % stock[i]

orange
prices: 1.5
stock: 32
pear
prices: 3
stock: 15
banana
prices: 4
stock: 6
apple
prices: 2
stock: 0
None

what's wrong with the orange code?
I think the output is correct.


#2

This is a very, VERY usual problem in Codecademy. Your code is right, but you must print

"price: %s"

Instead of

"prices: %s"

Because of the system wants you to print just "price:" and "stock" all by lowercase, there are always this kind of problems. I really hope that this gets fixed...


#3

Thank you for your answer.


#4

No problemo, this is a very usual problem. And as I said this wouldn't be hard to fix.


#5

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