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


#1



This seems to be a reoccurring problem for a lot of people. Can't figure out what to do with this. Any suggestions?


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


#2

Not sure just what %g is, but working on it.

The values expected are floats. Something to keep in mind.


#3

2 posts were split to a new topic: Why only orange would lead to an error?


Why only orange would lead to an error?
#6