Home >>Python List Methods >Python List reverse() Method

Python List reverse() Method

Python List reverse() Method

Python list reverse() method is used to reverse the sorting order of the elements in the given input list.

Syntax:
list.reverse()
Here is an example of Python reverse() method:

a = ['Abhi', 'Mike', 'Jerry']
a.reverse()
print(a)

Output:
['Jerry', 'Mike', 'Abhi']
Example 2

a = ['PHP', 'Python']
a.reverse()
print(a)

Output:
['Python', 'PHP']

No Sidebar ads