What is printed?
s = {3, 1, 2}
print(sorted(s) == [1, 2, 3], list(s)[0] == 1)
- True True
- True False
- False True
- False False
sorted always orders a set; for these small ints the iteration order also starts at 1.
Play Problem Solving ▸
s = {3, 1, 2}
print(sorted(s) == [1, 2, 3], list(s)[0] == 1)