2021年3月27日星期六

The order of elements in a set

a = {1, 2, 3, 4, 5}  a.add(23)  a  {1, 2, 3, 4, 5, 23}  a.add(224)  a  {224, 1, 2, 3, 4, 5, 23}  a.add(300)  a  {224, 1, 2, 3, 4, 5, 23, 300}  

How does python order elements in a set? 224 is placed in the first place when I add it to the set but 23 and 300 was place in the end of the set.

https://stackoverflow.com/questions/66838214/the-order-of-elements-in-a-set March 28, 2021 at 11:46AM

没有评论:

发表评论