pop mudule lists python code example
Example 1: pop list python
#pop removes the last element
li=[1,2,3,4,5]
li.pop()
#>>>[1, 2, 3, 4]
Example 2: python list pop
# removes last element of list unless parameter is given
l1 = [1,2,3,4,5]
print(l1.pop()) # returns [1, 2, 3, 4]
print(l1.pop(2)) # returns [1, 2, 4, 5] removes element at given index