KnowledgeBoat Logo
|

Informatics Practices

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.

Python List Manipulation

4 Likes

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).

Answered By

3 Likes


Related Questions