ReferenceList methods
list.reverse()
Flips the order of the list in place.
Signature
items.reverse()Returns
None.
Example
Python
numbers = [1, 2, 3]
numbers.reverse()
print(numbers)
print(list(reversed([1, 2, 3])))Output
[3, 2, 1] [3, 2, 1]
Basics
Strings
Collections
Functions
Classes and objects
Modules and the standard library
Files and errors
Beyond the basics
ReferenceList methods
Flips the order of the list in place.
items.reverse()None.
numbers = [1, 2, 3]
numbers.reverse()
print(numbers)
print(list(reversed([1, 2, 3])))Output
[3, 2, 1] [3, 2, 1]