Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python reverse array

# method 1
arr = [11, 22, 33, 44, 55]
res = arr[::-1]
print("Reversed array:",res) #Reversed array: [5, 4, 3, 2, 1]

#method 2
arr = [11, 22, 33, 44, 55]
arr.reverse()
print("After reversing Array:",arr) #After reversing Array: [55, 44, 33, 22, 11]

#method 3
arr = [12, 34, 56, 78]
result=list(reversed(arr))
print("Resultant new reversed Array:",result) #Resultant new reversed Array: [78, 56, 34, 12]
Comment

python reverse array

array = [1, 2, 3, 4, 5]

reverse_array = array[::-1]
Comment

PREVIOUS NEXT
Code Example
Python :: triangle pattern in python 
Python :: ros python subscriber 
Python :: ValueError: There may be at most 1 Subject headers in a message 
Python :: urllib.error.HTTPError: HTTP Error 403: Forbidden 
Python :: factorise expression python 
Python :: valid parentheses with python 
Python :: how to get current time in milliseconds in python 
Python :: how to extract zip file in jupyter notebook 
Python :: txt file duplicate line remover python 
Python :: How to ungrid something tkinter 
Python :: pandas read ods 
Python :: how to use datetime to tell your age in python 
Python :: how to print for loop in same line in python 
Python :: order dataframe by multiple columns python 
Python :: glob read multiple images 
Python :: django login redirect 
Python :: emacs region indent python 
Python :: Python program to check leap year or not? 
Python :: pandas remove rows with null in column 
Python :: how to visualize decision tree in python 
Python :: hide particular attribute in django admin 
Python :: python for each attribute in object 
Python :: how to change number of steps in tensorflow object detection api 
Python :: np random array 
Python :: program to find even numbers in python 
Python :: python replace multiple spacis with spaces 
Python :: ordered char list python 
Python :: how to filter mask results in python cv2 
Python :: pandas sort values group by 
Python :: python for loop with array 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =