2

I know in python(below version-3.6), elements(key-value-pairs) are not ordered, dictionary type objects dn't remember the position each key-value-pair was first added.so ,if we create a dictionary d = {'banana': 3, 'apple': 4, 'pear': 1, 'orange': 2},the order will be diffrent when we iterate it or print it ,actually it wil be {'pear': 1, 'banana': 3, 'apple': 4, 'orange': 2}.

But today, when I tried python 3.6.1 , and I saw ,if I created a dictionary d = {'banana': 3, 'apple': 4, 'pear': 1, 'orange': 2} ,when I printed it ,the result will also be {'banana': 3, 'apple': 4, 'pear': 1, 'orange': 2}.
So, my question is, is the dictionary type in python 3.6 different from before.

nick
  • 843
  • 2
  • 7
  • 17

0 Answers0