Reverse numbers
Input
iterate_in_reverse([1,2,3])
Output
[3, 2, 1]
The function visits elements from the end to the start and collects them.
Full lesson preview
Traverse a sequence from the end to the start and collect elements in reversed order.
Problem statement
Task
Examples
Input
iterate_in_reverse([1,2,3])
Output
[3, 2, 1]
The function visits elements from the end to the start and collects them.
Input format
Output format
Constraints
Samples
Input
iterate_in_reverse(['a','b'])
Output
['b', 'a']
Reversed order of two elements.