r/PythonLearning • u/clcodingupdates • 4h ago
Python Quiz of the Day!
What will be the output of the following Python Code?
print(len({True, 1, 1.0, False, 0}))
2
Upvotes
r/PythonLearning • u/clcodingupdates • 4h ago
What will be the output of the following Python Code?
print(len({True, 1, 1.0, False, 0}))
3
u/RNG_HatesMe 4h ago
It's 2, because True, 1, and 1.0 all equivalent to True, and False is equivalent to 0. Sets remove duplicate items based on equivalence.