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)
1>>> l = list(range(1,5))
2>>> l
3[1, 2, 3, 4]
4>>> l.pop()
54
6>>> l
7[1, 2, 3]
8
1# Remove the last 3 items from a list
2x = [1, 2, 3, 4, 5]
3for i in range(3): x.pop()
1even_numbers = [2,4,6,8,10,12,15] # 15 is an odd number
2# if you wanna remove 15 from the list
3even_numbers.pop()