Test Index
Python Revision Tour
© examsnet.com
Question : 9 of 102
Marks:
+1,
-0
Assertion (A) :
[1,2,3]+'123' is an invalid expression in Python.Reason (R) : In Python, a list cannot be concatenated with a string.[CBSE 2026 Set 4]
Solution:
Explanation:Assertion: the
+ operator joins two objects only when both are lists (or both are strings, both tuples). Here a list is added to a string, so Python raises an error:>>> [1,2,3]+'123'TypeError: can only concatenate list (not "str") to listSo A is true.Reason: a list cannot be concatenated with a string. This is true, and it is exactly why the expression in A is invalid.Both are true and R correctly explains A.Answer:Option A (Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).)
© examsnet.com
Go to Question: