Python List Methods

Python List Methods

Python has a set of built-in methods that you can use on lists or arrays. Following are all of the methods of list objects:

Methods Explanation
append The list.append() method adds an item to the end of the list.
extend The list.extend() method extends the list by appending all the items from the iterable.
insert The list.insert() method adds an element at the specified position
remove The list.remove() method removes the first item with the specified value
pop The list.pop() method removes the element at the specified position of the list.
Clear The list.clear() method removes all the elements from the list
Index The list.index() method returns the index of the first element with the given list value.
Count The list.count() method returns the number of times x appears in the list.
Sort This method sorts the items of the list
Reverse This method reverses the elements of the list in place.
Copy The list.copy() method returns a copy of the specified list.

Example 1

Output

Example 2

Output

Example 3

Output