i : ( Position ) Position of the element to be removed ( 0 based index )
my_list=['a','b','c','d','e']
my_list.pop(2)
print(my_list)
Output ( element at position 2 , c is removed )
['a', 'b', 'd', 'e']
my_list=['Alex','Ronald','John']
my_list.pop() # deletes last element
print(my_list)
Output is here
['Alex', 'Ronald']
We can remove element from a particular position
my_list=['Alex','Ronald','John']
my_list.pop(0) # deletes first element
print(my_list)
Output is here
['Ronald', 'John']
We can collect the removed element
my_list=['Alex','Ronald','John']
name=my_list.pop(1) # deletes first element
print(name)
Output is here
Ronald
All list methods Questions with solutions on List clear() to remove all items
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.