In this article, you will learn how to reverse a list in python in Python.

Let’s say you have a list named ‘a’ with value [1, 2, 3, 4, 5].

a = [1, 2, 3, 4, 5]

In order to reverse a list, you can use the list.reverse() method.

a = [1, 2, 3, 4, 5]

## Reverse the list named 'a'
a.reverse()

print(a)
## => [5, 4, 3, 2, 1]

Note: The list.reverse() method functions by reversing the elements in a list.

#python

How to Reverse A List in Python
4.10 GEEK