I am new to Python and I am looking for clarification regarding sets. If I have a set
of numbers, does the set
always store the values inside it in ascending order? I wrote a quick example program
x = set()
x.add(1)
x.add(2)
x.add(0)
x.add(20)
x.add(3)
x.add(4)
print(x)
I got the output to be {0,1,2,3,4,20}
.
If that's the case then the minimum value will always be on the 0 index and the maximum value on the last index. But if that's not the case, then is there a way to get the index where the minimum/maximum value might be?