Open In App

Python-Quizzes | Python List Quiz | Question 9

Like Article
Like
Save Article
Save
Share
Report issue
Report

Find the output of the following program: 

Python3




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


Last Updated : 17 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads