Advertisements
Advertisements
प्रश्न
Assertion (A): [1,2,3]+‘123’ is an invalid expression in Python.
Reason (R): In Python, a list cannot be concatenated with a string.
पर्याय
Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A).
Assertion (A) is true, but Reason (R) is false.
Assertion (A) is false, but Reason (R) is true.
MCQ
विधान आणि तर्क
Advertisements
उत्तर
Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A).
Explanation:
In Python, the + operator performs concatenation only when both operands are of the same data type. Since [1, 2, 3] is a List and '123' is a String, attempting to add them results in a TypeError, making the expression invalid as stated.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
