Exercise 6: Reverse the Array

Put the elements in the array in reverse order.

Problem statement

Reverse the array so that the first element appears last, the second element appears second to last, and so on.

Example

input_array = [1, 2, 3, 4, 5]
result =  [5, 4, 3, 2, 1]

Note: Look through the methods listed in the Array documentation to see if any of these describes what we’re looking for.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy