Keeping Track of the Produce


#1




Hello. I have next error:
"Oops, try again. Check what your code prints for orange. It doesn't look quite right!"
What am I doing wrong?


Replace this line with your code. 
prices = {
    "banana":4,
    "apple":2,
    "orange":1.5,
    "pear":3
    }

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


#2

your print lines need to look like this

print "price: %s" % prices[key]
print "stock: %s" % stock[key]

because it's specific about wording. Additionally, it needs to be
for key in prices:, not for key in stock:


#3

Thank you so much. You really helped me.


#4

No problem, glad to assist. :slight_smile:


#5

this the code i have wriiten
prices = {"banana":4, "apple":2, "orange":1.5, "pear":3}
stock = {"banana":6, "apple":0, "orange":32, "pear":15}
for key in prices:
print "%s" % key
print "Prices: %s" % prices[key]
print "Stock: %s" % stock[key]

still the same error "Oops, try again. Check what your code prints for orange. It doesn't look quite right!"


#6

You must print key, but not print "%s" % key
sory for bad English)


#7

still the same error


#8

for key in prices:
print key
print "Prices: %s" % prices[key]
print "Stock: %s" % stock[key]


#9

try this)
and..
do not forget tab


#10

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