What is the output of print({1, True, 2}) in Python?
print({1, True, 2})
Correct answer
C. {1, 2}
C. {1, 2}
1 and True are equal and hash the same, so only one appears in a set.
Asked in: Python Interview Output Prediction
https://docs.python.org/3/reference/datamodel.htmlNot sure why the answer is C? Ask here and get an explanation.