Introduction
In my previous article, Introduction to Python List, I explained the basics of lists and a few methods such as Index(), Append(), and Extend(). Now, let us understand the remaining List methods.
INSERT
The Insert method is used to insert an element into a list. It accepts two parameters, i.e.,
- The index which specifies the index of an element where you want to insert an element.
- Element is an element that you want to insert into the list.
Syntax- list.insert (index,element)
Example
- l=[2,4,6]
- l.insert(2,14)
- print(l) # will print [2,4,14,6]
Note
It accepts only two parameters; otherwise, it generates an error.

POP
This method is used to delete an element from the list from the end. It takes an index as an optional parameter. That is, if you don't pass any argument then it will remove the item from the end of the list; otherwise, it will remove the item from the specified position.
Syntax- list.pop()
list.pop(index)
- l=[2,3,8,7,9,6,5]
- l.pop()
- print(l) # will print [2,3,8,7,9,6]
- l.pop(3)
- print(l) # will print [2,3,8,9,6]
REMOVE
This method is used to delete an element from the List. However, it is different from the pop() method. Instead of deleting an element from the index, it will delete an element as per argument. That is, we can pass an element as an argument to be deleted.
Syntax- list.remove(element)
- l=[2,3,8,7,9,6,5]
- l.remove(3)
- print(l) # will print [2,8,7,9,6,5]

Sanjit Kumar SinghPosted Jul 20, 2019, 4:38 PM
awesome, keep posting.
Mahesh VermaPosted Jul 19, 2019, 10:06 AM
Nice article....keep it up :-)