Question 201 markSection A

Assertion (A) : [1,2,3]+'123' is an invalid expression in Python.

Reason (R) : In Python, a list cannot be concatenated with a string.

Python Revision Tour
Type Compatibility in Python Concatenation

Options

(A)Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
(B)Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
(C)Assertion (A) is true, but Reason (R) is false.
(D)Assertion (A) is false, but Reason (R) is true.

Official answer

Correct option: (A) — Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A).

Answer keywords:type compatibilitylist concatenationstring concatenationTypeError+ operatorsequence typesPython data types

Marking scheme

  1. 1.1 mark for selecting option (A); no partial marks in Assertion-Reason questions.

Hint

Try concatenating a list and a string mentally with '+' and recall Python's rule that '+' needs matching sequence types on both sides.

Quick oral answer

The expression [1,2,3]+'123' is invalid because Python's '+' operator requires both operands to be the same sequence type — you cannot directly concatenate a list with a string.

Common mistakes

  1. 1.Believing Python automatically converts the string to a list of characters or the list to a string before concatenation — Python does NOT perform such implicit conversions with '+'.
  2. 2.Selecting option (B), mistakenly thinking Reason (R) is a true but unrelated statement rather than recognising it directly explains Assertion (A).

Analysis and explanation

This question tests the rule that the '+' operator, when used for concatenation, requires BOTH operands to be of the SAME sequence type.


Checking Assertion (A)

  • [1,2,3] is a list and '123' is a string — two different sequence types.
  • Attempting [1,2,3]+'123' raises TypeError: can only concatenate list (not "str") to list.
  • So the expression IS invalid, making Assertion (A) true.

Checking Reason (R)

  • Python's '+' operator for sequences is type-strict: list+list works, str+str works, but list+str does not.
  • Reason (R) states exactly this rule, so it is also true.

Linking A and R

  • Reason (R) is precisely WHY the expression in Assertion (A) fails — the general rule (R) directly explains the specific invalid case (A).
  • Hence option (A) is correct: both statements true, and R correctly explains A.

Interesting facts

The exact Python error for this case is `TypeError: can only concatenate list (not "str") to list` — a very commonly seen runtime error among beginners.

To concatenate a list and characters of a string, one must explicitly convert, e.g. `[1,2,3] + list('123')`, which converts the string into `['1','2','3']` first, making both operands lists.

Question details

Q20 of 48 questions

Board
CBSE
Class
Class 12
Subject
Computer Science
Year
2026
Section
Section A
Marks
1
Chapter
Python Revision Tour
Topic
Type Compatibility in Python Concatenation
Bloom's level
analyze
Syllabus topic
Unit 1: Computational Thinking and Programming — Python Data Types (List and String Operations)
Author
CBSE
Reviewed by
Padhantu Academic Team

Spotted a mistake or something unclear?

Tell us and we will fix it.

Frequently asked questions

Why does [1,2,3]+'123' raise an error in Python?

Because Python's '+' operator for sequences requires both operands to be of the same type; here a list and a string are being concatenated, which is not permitted.

How can you correctly combine a list and characters of a string in Python?

Convert the string to a list first using list(), e.g. [1,2,3] + list('123'), which produces [1, 2, 3, '1', '2', '3'].