Keeping track of the produce


I am getting an error message that says that what I'm printing for orange isn't quite right
Can anyone help?

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 x in prices:
    print x
    print "Prices: %s" % prices[x]
    print "Stock: %s" % stock[x]


Prices: %s

price not Prices

also s of Stock should be lowercased! ("Stock: %s")


Ohhhhhhh thanks! Now it works


I made the printing part like this, but was not accepted. Why?

for key in prices:
print "%s \n price: %s \n stock: %s" % (key, prices[key], stock[key])


Yeah,You have to use certain format there like this..

Fruit Name
price: Fruit Price
stock: Fruit Stock

If you try to format any other way,It will not accept and throw an error.

Reason:They need exactly 3 print statements.

You should have exactly three print statements! (Make sure there are no occurrences of 'print' in any comment or string!)


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