List pop() Method

In Python Built-In List pop() method is used to removes and return the last object from the given list.

There is 1 Parameter used in the list pop() method: obj An optional parameter, and the index of the object to be removed from the given list.

list1 = ['TOM', 'JOHN', 'ALICE']
print ("List 1 : ", list1.pop())
print ("List 2 : ", list1.pop(1))

Comments are closed.