Advertisements
Advertisements
Question
Assertion (A): The expression "HELLO".sort()
in Python will give an error.
Reason (R): sort()
does not exist as a method/function for strings in Python.
Options
Both (A) and (R) are true and (R) is the correct explanation for (A).
Both (A) and (R) are true and (R) is not the correct explanation for (A).
(A) is true but (R) is false.
(A) is false but (R) is true.
MCQ
Assertion and Reasoning
Solution
Both (A) and (R) are true and (R) is the correct explanation for (A).
Explanation:
The sort() function does not work for strings, hence the command will return an error. The claim and reason statements are true and logical.
shaalaa.com
Is there an error in this question or solution?
2023-2024 (February) Set 4