Answers for "how to reverse an array using function in pyhton"

21

how to reverse array in python

a = [1,2,3,4]
a = a[::-1]
print(a)
>>> [4,3,2,1]
Posted by: Guest on March-06-2020
-1

reverse array python

#The original array
arr = [11, 22, 33, 44, 55]
print("Array is :",arr)
 
res = arr[::-1] #reversing using list slicing
print("Resultant new reversed array:",res)
Posted by: Guest on April-15-2022

Code answers related to "how to reverse an array using function in pyhton"

Python Answers by Framework

Browse Popular Code Answers by Language