Python lists maintain an order, and sometimes you need to reverse that order so the last element becomes first and the first becomes last. The standard list method for reversing the elementsin placeis reverse(). For example, if nums = [1, 2, 3, 4], then nums.reverse() mutates the list so it becomes [4, 3, 2, 1]. This is a built-in operation taught in introductory programming texts because it is efficient and conceptually simple: it does not create a new list unless you explicitly copy the data.
It is important to distinguish reversing from sorting. Reversing changes the sequence order as-is, while sorting rearranges elements according to comparisons. The question refers to converting the index order to the opposite, which is reversing. If you wanted descendingsortedorder, you would typically use sort(reverse=True) or sorted(nums, reverse=True). But the direct method that reverses the list’s order is reverse().
The other options are not standard Python list methods. sortDescending(), flip(), and invert() are not part of Python’s built-in list API. Textbooks emphasize learning the correct method names because Python’s standard library provides a consistent, widely used interface across programs. Thus, reverse() is the correct answer for reversing the index order of a list.
Submit