Python List reverse() Method Tutorial

In this section, we will learn what the List reverse() method is and how to use it in Python.

How to Reverse a List in Python: reverse() Method

The Python list reverse() method is used to reverse the order of a list of elements.

This means after invoking this method on a list, the first elements of the list will go to the end and vice versa.

List reverse() Method Syntax:

list.reverse()

List reverse() Method Parameter:

The method does not take an argument.

List reverse() Method Return Value:

The method does not return a value.

Example: python reverse list

li = ["ItemOne","ItemTwo","ItemThree","ItemOne","ItemTwo","ItemThree"]

print(li)

li.reverse()

print(li)

Output:

['ItemOne', 'ItemTwo', 'ItemThree', 'ItemOne', 'ItemTwo', 'ItemThree']

['ItemThree', 'ItemTwo', 'ItemOne', 'ItemThree', 'ItemTwo', 'ItemOne']
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies