I. [::-1]
import numpy as np import numpy as np x = (1, 6) print("Original array:") print(x) print("Reverse array:") x = x[::-1] print(x) ''' Original array: [1 2 3 4 5] Reverse array: [5 4 3 2 1] '''
[::-1] : will output the elements of the array in reverse direction
II. [::-1,::-1]
nums=([[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16]]) print(nums[::-1,::-1]) ''' [[16 15 14 13] [12 11 10 9] [ 8 7 6 5] [ 4 3 2 1]] '''
to this article on the specific use of python [::-1] [::-1,::-1] article on this, more related python [::-1] [::-1,::-1,::-1] content, please search for my previous posts or continue to browse the following related articles I hope that you will support me in the future!