ERROR in module 'Keeping Track of the Produce'


#1



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


My code is behaving just fine - however the "submit checker" says to check that the value of "orange" is printing properly....it is. so are all of the other values.


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

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

for item in prices:
    print item
    print "Price: %s" % prices[item]
    print "Stock: %s" % stock[item]


#2

I capitalized the strings "Price: ..." and "Stock: ..."

Removed the capitalization and the code checks fine now...FYI


#3

I can confirm this bug.

My print section looks like this:

for key in prices:
    print key
    print "price:", prices[key]
    print "stock:", stock[key]

I also receive the same error, namely:

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

I also tried changing the first print to print str(key)


#4

That's how I did it at first too, even though that works, you have to copy the syntax in their example:

for key in prices:
    print key
    print "price: %s" % prices[key]
    print "stock: %s" % stock[key]

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.