Th orange error!


#1

The orange error!
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]



I am getting an error that value for orange is not correct though I sis showing correct values
orange
Price: 1.5
Stock: 32
pear
Price: 3
Stock: 15
banana
Price: 4
Stock: 6
apple
Price: 2
Stock: 0
None


Replace this line with your code.


#2

Hi, @thekulwindersingh ,

For this exercise and many others, your output must adhere closely to the spelling and case specified in the instructions. Compare your output to the given specifications. The example provided is ...

apple
price: 2
stock: 0

#3

Thnx @appylpye :slight_smile: I missed a simple thing.


#4

I still don't know what's wrong with the code


#5

its nothing but a simple spelling mistake if u look at the instructions it gives an example of the output in the format :
apple
price: 2
stock: 0

So just change the spelling in the code that you wrote like:
print key
print "price: %s" % prices[key]
print "stock: %s" % stock[key]

Notice, i wrote price in the string and not prices.. this causes the error.
If, u do this then there will be no Orange error..


#6