1# The pop function, without an input, defaults to removing
2# and returning the last item in a list.
3myList = [1, 2, 3, 4, 5]
4myList.pop()
5print(myList)
6
7# You can also do this without returning the last item, but it is
8# much more complicated.
9myList = [1, 2, 3, 4, 5]
10myList.remove(myList[len(myList)-1])
11print(myList)
1mylist = [0, 1, 2]
2mylist[-1] = 3 # sets last element
3print(myList[-1]) # prints Last element
1# Remove the last 3 items from a list
2x = [1, 2, 3, 4, 5]
3for i in range(3): x.pop()