How to Reverse Array in Python
In this example you will learn that how to reverse array in python programming. We will do this reverse array elements program by using 2 different ways.
Program 1 : Reverse Array in Python
1 2 3 4 | arr=[10,20,30,40,50,60,70] for i in reversed(arr): print(i) |
Output
70
60
50
40
30
20
10
Program 2 : Reverse Array in Python
1 2 3 4 5 | arr = [10, 20, 30, 40, 50, 60, 70] # Printing the array elements in reverse order for i in range(len(arr)-1, -1, -1): print(arr[i], end=" ") |
Output
70 60 50 40 30 20 10
Check out our other Python examples