pop function list code example
Example 1: pop function python
# programming languages list
languages = ['Python', 'Java', 'C++', 'French', 'C']
# remove and return the 4th item
return_value = languages.pop(3)
print('Return Value:', return_value)
# Updated List
print('Updated List:', languages)
Example 2: pop list python
#pop removes the last element
li=[1,2,3,4,5]
li.pop()
#>>>[1, 2, 3, 4]