Skip to content
Related Articles

Related Articles

Python-Quizzes | Python List Quiz | Question 15

View Discussion
Improve Article
Save Article
  • Last Updated : 17 Sep, 2020

Question 15: Find the output of the following program:

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

(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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!