1. Home
  2. Data Science
  3. Python
  4. What will be the result of ['a', 'b', 'c'] * 2 in Python?

Added 4 May 2024

What will be the result of ['a', 'b', 'c'] * 2 in Python?

  1. ['a', 'b', 'c', 'a', 'b', 'c'] Correct answer
  2. [['a', 'b', 'c'], ['a', 'b', 'c']]
  3. ['aa', 'bb', 'cc']
  4. Error

Correct answer

A. ['a', 'b', 'c', 'a', 'b', 'c']

13 views

MCQSEXAM

Explanation

Multiplying a list by an integer duplicates its elements, so ['a', 'b', 'c'] * 2 results in ['a', 'b', 'c', 'a', 'b', 'c'].

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs