get the last item of a list python code example
Example 1: python last element of list
print(list[-1])
Example 2: python get last element of list
mylist = [0, 1, 2]
mylist[-1] = 3 # sets last element
print(myList[-1]) # prints Last element
print(list[-1])
mylist = [0, 1, 2]
mylist[-1] = 3 # sets last element
print(myList[-1]) # prints Last element