Built-in Functions and Types
reversed()
Create a reverse iterator without changing the original sequence. Objects can supply __reversed__(), or the function can work with length and integer indexing. A general forward-only iterator is not automatically reversible. Unlike sorted(reverse=True), this reverses traversal order rather than arranging elements by value.
Formal Syntax & Structure
python syntaxpython
reversed(seq, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| seq | reversible object | Object with reverse iteration or sequence protocol. |
Return Value
iterator
Single-pass iterator traversing in reverse order.
Working Example
Example Snippetpython
letters = ["b", "a", "c"]print(list(reversed(letters)))print(letters)