8/13 print problem


#1

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.


#2

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


#3

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]


#4

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


#5

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]