CBSE · 083Class XII · 2024Section A1 mark
Question 18
2 April 2024 · Computer Science (083)
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.
Answer
(a) Both (A) and (R) are true and (R) is the correct explanation for (A).
Explanation
Strings in Python are immutable and do not have a sort() method; they use sorted().