8.Keeping Track of the Produce


#1

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

stock = {"banana": 6,
"apple": 0,
"oranges": 32,
"pear": 15
}

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

Error : Oops, try again. Check what your code prints for pear. It doesn't look quite right!

Please Help me for this Error


#2

Try changing oranges to orange


#3

No it's pears that isn't working for him.

The same is happening to me.


#4

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

if it isn't printing pears check the typed in messages for pears throughout the code.


#5

It works for me, try this:

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]


#6

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