Why it is not working?


#1



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

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

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

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

Oops, try again.
You should have exactly three print statements! (Make sure there are no occurrences of 'print' in any comment or string!)


Replace this line with your code.


#2

i count 6 print statements, so the error make sense?


#3

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


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]


error

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


#4

make sure the strings printed are an exact match (for example, prices: should be price:


#5

@apurva4u
In the line:

print "prices: %s" % prices[i]

Change the line to:

print "price: %s" % prices[i]

The console is checking that you are printing the word "price" rather than "prices" which is why it's telling you to check what the code prints for orange.


#6

Thank u...prob is solved.

but it should not be the error, right?
u can print any statement in prints, here price and prices in strings are treated same for print.


#7

except the exercise mentions that it wants an exact match of the displayed output in the instructions, which means the checking script validates this strict