1

I read about python set

x = set(["a","b","c","d"])
y = set(["c","d"])
print( x.intersection(y) )

I am getting output as {'d', 'c'} or {'c', 'd'} each time.

Though its correct, I am just curious about sequence of set item

How interpreter read set?

Shri
  • 703
  • 3
  • 11
  • 28

1 Answers1

1

That is happening because a set does not maintain order like a list does. Take a look at this link here for a great description of the different Python structures and when to use them: https://stackoverflow.com/a/3489100/1199721

Community
  • 1
  • 1
Pep_8_Guardiola
  • 5,002
  • 1
  • 24
  • 35