8/13 print problem


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

it replies me"oops try again.You should have exactly three print statements:(make sure there are no occurencies of 'print' in any comment or string!)

somebody help please.


Add spaces between "print" and your strings. It won't validate properly otherwise.


along with what @tacobob said, you also need a space inbetween prices and %s
Also it has to be 'price' not 'prices'

print "price: %s" % prices[key]


thanks a lot,ryebread4 correction together with Tacobob correction makes it work.


Try this:
price = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15

for key in price:
print key
print "price: %s" % price[key]
print "stock: %s" % stock[key]