Open In App

Python-Quizzes | Python List Quiz | Question 9

Find the output of the following program: 




list1 = [1998, 2002]
list2 = [2014, 2016]
 
print ((list1 + list2)*2)

(A)



[1998, 2002, 2014, 2016, 1998, 2002, 2014, 2016]

(B)



[1998, 2002, 2014, 2016]

(C)

[1998, 2002, 1998, 2002]

(D)

[2014, 2016, 2014, 2016]

Answer: (A)
Explanation:

When the addition(+) operator uses a list as its operands then the two lists will get concatenated. And when a list id multiplied with a constant k>=0 then the same list is appended k times in the original list.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :