Sets data structure

In the first set s the o/p is ordered.
But in the 2nd set s2, it is unordered. But you said the set is unordered. So why it didn’t happen for the first set??

It’s just a matter of coincidence . In python the elements in a set do not have any index associated with them , hence their output is random .