← Back to challenges

Reverse a List

PythonMediumarraysnumberslanguage_fundamentals

Instructions

Write a function to reverse a list.

Examples

reverse([1, 2, 3, 4]) ➞ [4, 3, 2, 1]

reverse([9, 9, 2, 3, 4]) ➞ [4, 3, 2, 9, 9]

reverse([]) ➞ []
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Array of Word Lengths