pop() to remove item based on position in a list

pop(i) takes one argument as position ( optional ) .

i : ( Position ) Position of the element to be removed ( 0 based index )

If no position is given ( input i ) then last element of the list is removed.
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']

Using String

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
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com







Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer