
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With