What's wrong with orange?


#1

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

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


#2

Click here for a very useful trick you can use whenever you want to paste code into the forum.

That being said, it could be a simple matter of formatting. When you hit "Save & Submit Code" the code validator is looking for very specific cues in your code to evaluate if you followed instructions and sometimes it can be difficult to catch all exceptions.

If we look closely at the instructions, my guess is that you would need to add a space between your : and your %s like so:

# from
print "price:%s"%prices[n]
print "stock:%s"%stock[n]
# to
print "price: %s"%prices[n]
print "stock: %s"%stock[n]

It should do the trick... :smile:


#3

thank you very much!!!