prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
stock = {
"banana": 6,
"apple" : 0,
"orange": 32,
"pear": 15
}
for item in prices:
print item
print "price: %s" % prices[item]
print "stock: %s" % stock[item]
The outout of the following code gives the following output
orange
price: 1.5
stock: 32
pear
price: 3
stock: 15
banana
price: 4
stock: 6
apple
price: 2
stock: 0
None
I want to ask why is it displayed in this way (in sorted order) . Isn't banana should come first , then apple , orange and pear ?