10.Oops, try again. Check what your code prints for orange. It doesn't look quite right!




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

stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
for apple in prices:
print "apple"
print "Price: %s" % prices["apple"]
print "Stock: %s" % stock["apple"]

Help pls!
I added variable X


Suggest use a generic variable, and not apple.

for item in prices:

Now use the variable without quotes in the dictionary accessor...


Be sure to print all lowercase (see the example in the lesson text).


Please do not edit your post once you receive a reply. Post new code in a reply.

You still have upper case in your print out.


print "price:", prices[x]
print "stock:", stock[x]


The exercise expects string formatting.

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


Thank you . The correct code came out


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