Python Code issue


#1

https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096

Code:

prices={"banana":"4","apple":"2","orange":"15","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]

Output:
orange
pear
banana
apple
None

My query is , why orange is coming first in the output.??
if i run the same code outside am getting proper output where banana should come first.


#2

dictionary's are unordered, except for the latest version (>3.6) of python, in which compact dictionaries are implemented, which preserve order (source)