Keeping Track of Produce Help


#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 says check what my code prints for orange.I’m confused.


#2

Did you check existing topics first? It took me 30 seconds to find one:

which has an identical problem + explanation about how to solve the problem


#3

for key in prices:
print key
print “prices: %s” % prices[key]
print “stock: %s” % stock[key]

Change “prices” to “price” so it looks like the following:

for key in prices:
print key
print “price: %s” % prices[key]
print “stock: %s” % stock[key]

Code Academy is very fussy on what you type - I had the same problem but because I had the following format:

key
Price:
Stock:

Once I changed from capitals it worked.

It’s frustrating.


#4

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