Keeping Track Of Produce - A Day at the Super Market - Python


#1

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

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

I am getting the error "Oops, try again. Check what your code prints for orange. It doesn't look quite right!"
but in output console. I get what i need


#2

Not sure about this line. Do you really need it?


#3

Yes, So that i can view the price and stock for the particular items


#4

Hello friends,

I also have the same error for the code below.

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:%f" % prices[key]
     print "stock:%s" % stock[key]`indent preformatted text by 4 spaces`

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

could anyone help me in this?