Answers for "how to get last element in numpy array"

1

how to get last element in numpy array

In [10]: arr = numpy.array([1,23,4,6,7,8])

In [11]: [(arr[i], arr[-i-1]) for i in range(len(arr) // 2)]
Out[11]: [(1, 8), (23, 7), (4, 6)]
Posted by: Guest on October-25-2020

Code answers related to "how to get last element in numpy array"

Python Answers by Framework

Browse Popular Code Answers by Language