lunakid
0
Q:

reverse array python

>>> the_list = [1,2,3]
>>> reversed_list = the_list.reverse()
>>> list(reversed_list)
[3,2,1]

OR

>>> the_list = [1,2,3]
>>> the_list[::-1]
[3,2,1]
28
a = [1,2,3,4]
a = a[::-1]
print(a)
>>> [4,3,2,1]
2
>>> L = [0,10,20,40]
>>> L[::-1]
[40, 20, 10, 0]
1
array=[0,10,20,40]
reversed_array=array[::-1]
2
nums.sort(reverse=True)
nums
5
list=[1,2,3]
list[::-1]
3
# The Reverse operation - Python 3:
Some_List = [1, 2, 3, 4, 1, 2, 6]  
Some_List.reverse()  
print(Some_List)
# Result: [6, 2, 1, 4, 3, 2, 1]
0
>>> array=[0,10,20,40]
>>> for i in reversed(array):
...     print(i)
0

New to Communities?

Join the community