Keeping track of the produce


#1



prices = {
    "banana":4,
    "apple":2,
    "orange":1.5,
    "pear":3,
    }
stock = {

    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15,
    }
print "apple"    
for apple in prices:
    print "price : %s"%prices['apple']    
for apple in stock:
    print "stock : %s"%stock['apple']

output:
apple
price : 2
price : 2
price : 2
price : 2
stock : 0
stock : 0
stock : 0
stock : 0
None 
please tell me error??


#2

price: and stock:, there can't be a space before the colon

each iteration, you should also print the product name. I would personally only use one loop.

here:

stock['apple']

why is apple a string? why not a variable (the iterator of your loop)?


#3

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

#4

you should a space after the colon. Take a look at the desired output, and compare every character


#5

thanks Codecademy Moderator


#6