October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Reverse an Array in Python: 6 Practical Ways

Choose the right Python reversal method for the object and outcome you need: mutate a list or typed array, create a reversed list, or iterate backward without copying.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Python, the right way to reverse an “array” depends on its type and whether you want to change the original. For a built-in list, use items.reverse() to reverse it in place, items[::-1] or list(reversed(items)) to make a new list, and reversed(items) to iterate backward without making a list. Python’s standard-library array.array is a separate type with its own in-place reverse() method.

First, identify what “array” means in your Python code

Python’s built-in list is the sequence most examples mean when they say “array,” but it is not the same type as array.array or a third-party array such as NumPy’s. These types have different characteristics, so choose a method for the object you actually have. The Python FAQ covers reverse iteration over sequences; the standard-library array documentation describes array.array.

As an Amazon Associate I earn from qualifying purchases.

The examples below use items = [1, 2, 3, 4]. Their central difference is whether they modify items, produce a new list, or simply traverse the values in reverse order.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reverse a built-in list in five ways

1. Reverse the list in place with list.reverse()

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

print(items)  # [4, 3, 2, 1]

reverse() changes the existing list and returns None. Call it as a statement; do not write items = items.reverse(), which replaces the list reference with None. The Python list tutorial documents list methods that modify the list in place.

2. Make a reversed list with a slice

items = [1, 2, 3, 4]
reversed_items = items[::-1]

print(reversed_items)  # [4, 3, 2, 1]
print(items)           # [1, 2, 3, 4]

The slice [::-1] uses a step of -1, giving a reversed list while leaving the original list order unchanged. Use it when you want a list result and do not want to mutate the source.

3. Make a list from reversed()

items = [1, 2, 3, 4]
reversed_items = list(reversed(items))

print(reversed_items)  # [4, 3, 2, 1]
print(items)           # [1, 2, 3, 4]

The built-in reversed() produces an iterator, not a list. Wrapping it in list() consumes that iterator and materializes the values in reverse order. The Python built-in functions reference describes reversed() as returning a reverse iterator.

4. Iterate backward without making a new list

items = [1, 2, 3, 4]

for item in reversed(items):
    print(item)

This visits 4, 3, 2, then 1, without changing items or building a reversed list. Choose it when you only need to process values in reverse order. The Python FAQ recommends reversed() for traversing a sequence backward without touching the original.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Swap elements with a two-index loop

items = [1, 2, 3, 4]
left = 0
right = len(items) - 1

while left < right:
    items[left], items[right] = items[right], items[left]
    left += 1
    right -= 1

print(items)  # [4, 3, 2, 1]

The loop swaps the outermost pair, then moves both indices toward the center. It changes the original list. This makes the algorithm visible for learning, but for ordinary list reversal the built-in reverse() method is clearer.

Reverse a standard-library array.array

6. Use array.array.reverse()

from array import array

values = array("i", [1, 2, 3, 4])
values.reverse()

print(values)  # array('i', [4, 3, 2, 1])

array.array is a mutable, typed sequence for constrained basic values, rather than a built-in list. Its reverse() method reverses the elements in place. The type code determines the stored value type, and representation details can depend on machine architecture; see the official array reference.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose by the result you need

Need Use Changes original? Result
Reverse a built-in list itself items.reverse() Yes The same list, reversed
A reversed list, keeping the source order items[::-1] No A new list
A reversed list via the reverse iterator list(reversed(items)) No A new list
Process values from last to first for item in reversed(items) No Reverse-order iteration
Learn the swapping algorithm Two-index loop Yes The same list, reversed
Reverse a standard-library typed array values.reverse() Yes The same array.array, reversed

For NumPy arrays or another third-party array type, consult that library’s documentation rather than assuming the built-in list or array.array behavior applies.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.