List Methods

list.reverse()

Reverses the current positional order of the list in place, without comparing the elements. This is not a descending sort. Aliases observe the change. Use reversed(items) for an iterator in reverse order or items[::-1] for a new shallow list with reversed order.

Formal Syntax & Structure

python syntaxpython
items.reverse()

Return Value

None

The original list changes; no new list is returned.

Working Example

Example Snippetpython
steps = ["test", "build", "test"]steps.append("deploy")result = steps.reverse()print(steps)print(result)
Python Reference