What is the output of print([1, 2] * 2) in Python?
print([1, 2] * 2)
Correct answer
A. [1, 2, 1, 2]
A. [1, 2, 1, 2]
Multiplying a list repeats its elements.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is A? Ask here and get an explanation.