Python Reverse a List
[::-1]Practice

Reverse — read items back-to-front

Undo a queue, flip a word, rotate a photo carousel — reversing lists is everywhere. Python gives you [::-1] and reversed().

Picture this: flip the row

Last item becomes first. Or build a new list from the end.

[a, b, c]original
→
flip[::-1] or reverse()
→
[c, b, a]result

In easy words: What is reversing a list?

Reversing means reading items from last to first instead of first to last. If list is [1,2,3], reversed list is [3,2,1].

Where this is used

Used in undo stacks, latest-first feeds, reversing route history, and anytime you need to process most recent items before older ones.

Theory: two ways to reverse

  • nums[::-1] — slice with step -1 returns a new reversed list.
  • reversed(nums) — returns an iterator; wrap with list() to materialise.
  • nums.reverse() — reverses in-place, changes the original list.

Real world: undo history

In a text editor, undo pops the action stack from the back — that is a reverse traversal. Chat apps show newest messages first — reversed timestamp list.

Animate the reversal

Original:

↓

Reversed:

1print(" ".join(map(str, reversed(nums))))
Press Animate

Example Program

1nums = [1, 2, 3]
2print(" ".join(map(str, reversed(nums))))