What is the output of print({1, 2} - {2, 3}) in Python?
print({1, 2} - {2, 3})
Correct answer
B. {1}
9 views
B. {1}
9 views
The - operator returns elements in the first set but not in the second.
Asked in: Python Interview Sets
https://docs.python.org/3/tutorial/datastructures.html#setsNot sure why the answer is B? Ask here and get an explanation.