list = [4,3,2,5,4]
last=list[len(list)-1]
some_list[-1]
array = ["a", "b", "c", "d"]
num_elements = 3
print(array[-num_elements:])
arr = ["cat", "dog", "rabbit"]
last_element = arr[-1]
slice = myarray[:,:,i]
>>> array = [0.0021, 0.12, 0.1224, 0.22]
>>> array[-1]
0.22
>>>
>>> some_list = [1, 2, 3]
>>> some_list[-1] = 5 # Set the last element
>>> some_list[-2] = 3 # Set the second to last element
>>> some_list
[1, 3, 5]