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


you forgot to print the product? (which is stored in key)


Please give the code for what you were asking to do


from the instructions:

Like the example above, for each key, print out the key along with its price and stock information. Print the answer in the following format:

price: 2
stock: 0

print out the key, you don't do this. add print key at the right place

asking/posting answers is against the guidelines?

guchuuu, you make a lot of topics, please fill in the template, the url is useful for people to access the exercise and debug your code, you didn't even specify which exercise you where at. So for the people who are trying to help you, it is really difficult to do so.

The error message can provide valuable information. You didn't include this either.

the template also provides you with backticks, so you can copy your code there, so the indent shows up

We are trying to help you, but we should be able to except some effort in return, to make a good topic?


Oh yes I may be better careful next time .


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