Please explain the behavior of the set in the image. I know that set is unordered but where are the other elements from the set a & b ?
Please explain the behavior of the set in the image. I know that set is unordered but where are the other elements from the set a & b ?
True and 1 are the same:
>>> True == 1
True
>>>
Since sets can't have duplicate values, it only takes the one that appears first.
You can see that if you convert True to int:
>>> int(True)
1
>>>
The output is 1.