Open In App

Python-Quizzes | Python List Quiz | Question 15

Question 15: Find the output of the following program: 




list = ['a', 'b', 'c'] * -3
print(list)

(A)



[\’a\’, \’b\’, \’c\’, \’a\’, \’b\’, \’c\’, \’a\’, \’b\’, \’c\’]

(B)



[\’c\’, \’b\’, \’a\’, \’c\’, \’b\’, \’a\’, \’c\’, \’b\’, \’a\’]

(C)

[ ]

(D)

[\’a\’, \’b\’, \’c\’]

Answer: (C)
Explanation:

An expression list[listelements]*N where N is an integer appends N copies of list elements in the original list. If N is a negative integer or 0 output will be an empty list else if N is positive list elements will be added N times to the original list.

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

Article Tags :