What is the output of print({1, 2} | {2, 3}) in Python?
print({1, 2} | {2, 3})
Correct answer
D. {1, 2, 3}
D. {1, 2, 3}
The | operator returns the union of two sets.
Asked in: Python Interview Sets
https://docs.python.org/3/tutorial/datastructures.html#setsNot sure why the answer is D? Ask here and get an explanation.