Keeping track of the produce: I am confuse!


Error : Oops, try again. Check what your code prints for orange. It doesn't look quite right!

After running the code the result prints the right value for orange. I am confuse

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 "prices: %s" %prices[key]
print "stock: %s" %stock[key]



Like the example above, for each key, print out the key along with its price and stock information. Print the answer in the following format:

price: 2
stock: 0

now check your it same?


How is it different please? I only added the 'print key' because I needed to make sure the answer appears as stated:

price: 2
stock: 1.5


Please help me understand how and where the error exist.


your output looks like

prices: 2
stock: 0

But it should be

price: 2
stock: 0

can you see the difference?
It should be exact same.


@mtf and @stetim94 help out here please


Interesting.. So all I had to do was remove the 's' in price's' and it is solved.

I just tried it and it turned out correct. Why is that a problem?


It's not a problem.system is checking whether you print the correct string or not.system is so strict(most of the time).sometimes a single space can create a problem.