Problem with my code printing


#1

Hello everyone,

My code seems to be ready, and the console looks right like the example, but it sends me an error like this:

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

Can someone please help me with my code?

have a look:

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]

 print

Thanks!! ( and sorry for my bad english) :grin:


#2

Could be your "print" at the end of the file that cause some issues with the console, try to remove it and relaunch it.


#3

Hi ,

I am getting the same error statement as above even without the print statement. Can you help me?

The error says
"Oops, try again. Check what your code prints for orange. It doesn't look quite right!"

I have posted my code below:

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]