Exercise 6: Reverse the Array
Put the elements in the array in reverse order.
We'll cover the following
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.
Try it yourself
def reverse_elements(input_array)result = []# Start your code herereturn resultend