Error even after correct output


The output is correct but it's giving me error: Oops, try again. Check what your code prints for orange. It doesn't look quite right!
I did print for orange also and the result is perfect for that too.

I think the code is correct and will work for any given key.

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

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

print "apple:"
for key in prices:
    if key=="apple":
        print "Price: %s" % prices[key]
        print "stock: %s" % stock[key]


i would remove this line:

if key=="apple":

then i would print the key (that is also required, see the output example instructions):

print key

then, make sure on the last two lines everything is spelled correctly (price with lowercase p)


Oh..sorry..i misinterpreted the problem statement and thought i need to print what's there in the screenshot provided with the problem statement. Thanks for your reply.


No need to apologize.