Reputation: 4657
I have this code:
mySet = {1,"2",3.0,True}
print("Set: " , mySet)
The output is
Set: {1, 3.0, '2'}
What happened to the 'True' ?
Upvotes: 2
Views: 129
Reputation: 24059
Because set
save unique
value one time and 1
and True == 1
are same. For this reason, you see 1
one time.
>>> {1,True}
{1}
>>> {0,False}
{0}
>>> {'1',True}
{'1',True}
Upvotes: 5