CBSE Class 11 Informatics Practices Question 6 of 80

Lists in Python — Question 6

Back to all questions
6
Question

Question 6

Assertion (A): sort() method sorts the objects of list in ascending order.

Reasoning (R): Defining sort() method with reverse=True as an argument sorts the list elements in descending order.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
Answer

Both A and R are true and R is the correct explanation of A.

Explanation
The sort() function sorts the items of the list, by default in ascending/increasing order. If we want to sort the list in decreasing order, we need to write: sort(reverse = True).