best way to reverse an array in python code example
Example 1: reverse an array pyton
array=[0,10,20,40]
reversed_array=array[::-1]
Example 2: reverse array python
>>> array=[0,10,20,40]
>>> for i in reversed(array):
... print(i)
array=[0,10,20,40]
reversed_array=array[::-1]
>>> array=[0,10,20,40]
>>> for i in reversed(array):
... print(i)