Keeping Track of the Produce


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

I not sure what's wrong. It's printing
{'orange': 1.5, 'pear': 3, 'banana': 4, 'apple': 2}
{'orange': 1.5, 'pear': 3, 'banana': 4, 'apple': 2}
{'orange': 1.5, 'pear': 3, 'banana': 4, 'apple': 2}
{'orange': 1.5, 'pear': 3, 'banana': 4, 'apple': 2}

also how can i just print the name of the fruit.
Thanks in advance

Replace this line with your code. 
prices = {
    "apple": 2,
    "orange": 1.5,
    "pear": 3

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

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


Examine the example at left (in the lesson text). Our output needs to be exactly the same.

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


Ok i figured out what was wrong. I cant capitalize the words "Price and Stock". But i dont get why that makes a difference. if it is in the "". Can anyone tell me why? thanks in advance.


It is not an issue with the code, as such, just the lesson checker. It expects exactly one pattern, and will not accept any others.


@kentmjk ,

Yeah, part of the Codecademy experience is getting some practice in following instructions. Though your code may be fine as far as the Python interpreter is concerned, if you have not followed the exercise instructions precisely, Codecademy's Submission Correctness Test (SCT) is likely to get after you. :fearful:


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