Python reversed() Function

Example

Reverse the order of the list and print each item:

alph = ["a", "b", "c", "d"]
ralph = reversed(alph)
for x in ralph:
  print(x)

Running Instance

Definition and Usage

The reversed() function returns a reversed iterator object.

Syntax

reversed(sequence)

Parameter Value

Parameter Description
sequence Required. An iterable object.

Related Pages

Reference Manual:iter() Function(Returns an iterator object)

Reference Manual: list.reverse() Method (Reverse List)