Python .reverse()

christian.dinh's avatar
Published Jun 16, 2021Updated Sep 3, 2021
Contribute to Docs

Reverse the elements in the list.

Syntax

list.reverse()

The .reverse() method does not take in any arguments.

Example 1

counting = [1, 2, 3, 4, 5]
counting.reverse()
print(counting)
# Output: [5, 4, 3, 2, 1]

Example 2

To reverse a list called hand:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy