Oranges error!


#1



10.8

check what your code prints for orange

no error message


Replace this line with your code. 


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: ", prices[key] 
    print "stock: ", stock[key]


#2

Hi @pk_46,

Instead of this ...

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

... use format strings to compose your output, as Codecademy demonstrated in these example lines ...

    print "Once: %s" % once[key]
    print "Twice: %s" % twice[key]

Codecademy wants you to use a single expression in each print statement, as in their example.


#3

2 posts were split to a new topic: Keeping Track of the Produce: Oranges Error


#4

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