Error even after correct output


#1



https://www.codecademy.com/en/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096

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]


#2

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)


#3

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.


#4

No need to apologize.