ReferenceList methods

Python List reverse() Method

Short answer
list.reverse() flips the order of the items in a list in place and returns None; it does not sort anything.

reverse() simply turns the list around: the first item becomes the last and the last becomes the first. It does not look at the values at all, so [3, 1, 2] becomes [2, 1, 3], not [3, 2, 1]. If you want values in descending order, use sort(reverse=True) instead.

There are three common ways to get a reversed list, and choosing the right one depends on whether you want to change the original. See also slicing for the [::-1] form.

Quick facts
Syntaxmy_list.reverse()
ParametersNone
ReturnsNone (the list is modified in place)
Time complexityO(n)

How list.reverse() reverses a list in place

The method swaps items from the two ends toward the middle. No new list is created, so every name that refers to the list sees the change.

Python
laps = ["first", "second", "third"]
laps.reverse()
print(laps)

reverse() vs reversed() vs slicing [::-1]

Pick the tool by what you need back.

ToolChanges original?ReturnsWorks on
my_list.reverse()YesNoneLists only
reversed(seq)NoA reverse iterator (wrap in list() to see it)Sequences, and objects with __reversed__
seq[::-1]NoA new reversed sequence of the same typeLists, tuples, strings, ranges

When reverse() is the right choice

Use reverse() when you own the list and want to flip it without extra memory, for example turning a stack's contents into reading order. Use reversed() when you only want to loop backwards over a list: for x in reversed(items) avoids creating a copy. Use slicing when you need a new list or when the data is a tuple or string, which have no reverse() method. The Python reverse a list guide compares all the approaches in detail.

Examples you can run

Press Run, then edit the code and run it again.

Reverse a list in place

The list order is flipped and the variable still points at the same list.

Reverse a list in place
nums = [1, 2, 3, 4]
nums.reverse()
print(nums)
Expected output[4, 3, 2, 1]

Keep the original with slicing or reversed()

Both leave scores untouched.

Keep the original with slicing or reversed()
scores = [70, 85, 90]
print(scores[::-1])
print(list(reversed(scores)))
print(scores)
Expected output[90, 85, 70]
[90, 85, 70]
[70, 85, 90]

Sort and reverse are different

reverse() ignores the values; sort(reverse=True) orders them.

Sort and reverse are different
a = [3, 1, 2]
b = [3, 1, 2]
a.reverse()
b.sort(reverse=True)
print(a)
print(b)
Expected output[2, 1, 3]
[3, 2, 1]

Common mistakes

Using the return value

✗ Wrong

items = [1, 2, 3]
items = items.reverse()
print(items)
None

✓ Right

items = [1, 2, 3]
items.reverse()
print(items)

reverse() returns None. Call it alone, or use items[::-1] to get a new list.

Calling reverse() on a tuple or string

✗ Wrong

point = (1, 2, 3)
point.reverse()
AttributeError: 'tuple' object has no attribute 'reverse'

✓ Right

point = (1, 2, 3)
print(point[::-1])

Use slicing point[::-1] or tuple(reversed(point)). See AttributeError.

Printing a reversed() object

✗ Wrong

nums = [1, 2, 3]
print(reversed(nums))
<list_reverse_iterator object at 0x...>

✓ Right

nums = [1, 2, 3]
print(list(reversed(nums)))

reversed() returns an iterator. Wrap it in list() to see the items.

Python List reverse() Method: questions people ask

How do I reverse a list in Python?

Call my_list.reverse() to flip it in place, or use my_list[::-1] or list(reversed(my_list)) to get a new reversed list.

Does reverse() sort the list in descending order?

No. It only flips the current order. To get descending order use my_list.sort(reverse=True).

Does reverse() return the reversed list?

No, it returns None because it changes the list in place.

Keep learning

Step-by-step lessons:
Python ListsPython List MethodsPython Slicing

Related:
Python List sort() MethodHow to Reverse a List in PythonPython List copy() MethodPython List Methods

More in list methods:
Python List append() MethodPython List extend() MethodPython List insert() MethodPython List remove() MethodPython List pop() MethodPython List clear() MethodPython List index() MethodPython List count() Method See all →