Orange problem in "8. Keeping Track of the Produce"


#1



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


Oops, try again. Check what your code prints for orange. It doesn't look quite right!
This is the message that pops up despite the fact that I did run the program


I have seen replies in replacing the prices for price but still does not happen anything. If you look closely, even though the dictionary is in prices, I am printing price in singular. The format is exactly as shown in the instructions yet the message keeps popping. I am guessing it has to do with the order?


prices = {
    "banana" : 4,
    "apple" : 2,
    "orange" : 1.5,
    "pear" : 3
    }
    
stock = {
    "banana" : 6,
    "apple" : 0,
    "orange" : 32,
    "pear" : 15
    }
    
for fruit in prices:
    print fruit
    print "price : %s" % prices[fruit]
    print "stock : %s" % stock[fruit]


#2

Take out the space before the colon in this and the next line.


#4

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