.reverse()

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:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy