python get last to items in array code example
Example 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)]
Example 2: how to get the last value in a list python
your_list = ["apple", "orange", "grapes"]
last_value = your_list[-1]