VOOZH about

URL: https://www.geeksforgeeks.org/python/python-list-reverse/

⇱ Python List Reverse() - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python List Reverse()

Last Updated : 25 Apr, 2025

The reverse() method is an inbuilt method in Python that reverses the order of elements in a list. This method modifies the original list and does not return a new list, which makes it an efficient way to perform the reversal without unnecessary memory uses.

Let's see an example to reverse a list using the reverse() method.


Output
[6, 2, 1, 4, 3, 2, 1]

Explanation: Here, the reverse method simply reverses the list.

Syntax of List reverse()

list_name.reverse()

Parameters: It doesn't take any parameters.

Return Value: It doesn't return any value.

Note: The reverse() method is specific to lists in Python (it's an attribute of a list). Therefore, attempting to use the reverse() method on other data structures, such as strings, tuples, sets, or dictionaries, will result in an error.

Example of List reverse()

Reversing a list of strings

In this example, we are reversing the list of strings using reverse() method.


Output
['date', 'cherry', 'banana', 'apple']

Reverse a list of mixed data types

In this example, we are reversing the list of mixed data types using reverse() method.


Output
[True, 2.5, 'apple', 1]

Reverse() vs. Slicing Approach

Another common way to reverse a list in Python is using slicing ([::-1]). Let's take an example of reversing a list using slicing.


Output
[5, 4, 3, 2, 1]

Explanation: The slicing approach [:: -1] creates a new list, which requires additional memory, whereas reverse() modifies the existing list.

Note: If we want to keep the original list without modifying it then should use slicing. But if we need to change the list directly then use reverse().

Related Article:

Comment