1

In Python set is unordered, But printing the numbers, it's giving the result is ordered.

Can anyone clarify this?

set2={10,11,12,13,14} print(set2)

O/P: {10, 11, 12, 13, 14}

Silvio Mayolo
  • 62,821
  • 6
  • 74
  • 116
  • 1
    I can't find the reference answer at the moment, but this has to do with the way Python hashes small integers. The set isn't actually ordered numerically. – sj95126 Oct 02 '22 at 05:11

0 Answers0