Python List Methods

Last Updated : 3 Jan 2026

Python Lists offers a wide range of built-in methods to manipulate data efficiently. List in Python, is an ordered and mutable data type allowing us to store multiple values in a single variable.

Let us take a look at various List methods available in Python.

MethodDescription
append()This method is utilized to add an element x to the end of the list.
extend()This method is utilized to add all elements of an iterable (list, tuple, etc.) to the list.
insert()This method is utilized to insert an element x at index i.
remove()This method is utilized to remove the first occurrence of x. It raises ValueError if x is not found.
pop()This method is utilized to remove and returns the element at index i (default is the last element).
clear()This method is utilized to remove all elements, making the list empty.
index()This method is utilized to return the first index of x between start and end. It raises ValueError if not found.
count()This method is utilized to return the number of occurrences of x in the list.
sort()This method is utilized to sort the list in place (default is ascending).
reverse()This method is utilized to reverse the order of the list in place.
copy()This method is utilized to return a shallow copy of the list.

1) append()

The append() method in Python allows us to add an element at the end of the list.

Syntax:

It has the following syntax:

Python append() Method Example

Let us take an example to demonstrate the append() method in Python.

Example

Compile and Run

Output:

 
List of Fruits: ['apple', 'mango', 'banana', 'orange', 'guava']
Updated List of Fruits: ['apple', 'mango', 'banana', 'orange', 'guava', 'grapes']   

Explanation:

In the above example, we have used the append() method to add a new element 'grapes' at the end of the given list.

2) extend()

The extend() method in Python allows us to append all the elements from an iterable (list, tuple, set, etc.) at the end of the list.

Syntax:

It has the following syntax:

Python extend() Method Example

Let us take an example to demonstrate the extend() method in Python.

Example

Compile and Run

Output:

 
Old Shopping List: ['milk', 'bread', 'butter']
New Items: ['eggs', 'apples', 'coffee']
Updated Shopping List: ['milk', 'bread', 'butter', 'eggs', 'apples', 'coffee']   

Explanation:

In the above example, we have used the extend() method to add an iterable at the end of the given list.

3) insert()

The insert() method in Python allows us to insert an the elements at a specified position in the list.

Syntax:

It has the following syntax:

Python insert() Method Example

Let us take an example to illustrate how the insert() method works in Python.

Example

Compile and Run

Output:

 
Old Shopping List: ['milk', 'bread', 'butter', 'coffee']
New Shopping List: ['milk', 'bread', 'eggs', 'butter', 'coffee']   

Explanation:

In the above example, we have used the insert() method to insert item 'eggs' at the second index of the given list.

4) remove()

The remove() method in Python allows us to remove the first occurrence of the specified element from the list.

Syntax:

It has the following syntax:

Python remove() Method Example

Let us take an example to demonstrate the remove() method in Python.

Example

Compile and Run

Output:

 
Old Shopping List: ['milk', 'bread', 'eggs', 'butter', 'coffee']
New Shopping List: ['milk', 'bread', 'eggs', 'coffee']   

Explanation:

In the above example, we have used the remove() method to remove item 'butter' from the given list.

5) pop()

The pop() method in Python allows us to remove and return the element from the specified index of the given list.

Syntax:

It has the following syntax:

Python pop() Method Example

Let us take an example to demonstrate the pop() method in Python.

Example

Compile and Run

Output:

 
Old Shopping List: ['milk', 'bread', 'eggs', 'butter', 'coffee']
New Shopping List: ['milk', 'eggs', 'butter', 'coffee']
Popped Item: bread   

Explanation:

In the above example, we have used the pop() method to remove and return the item at index '2' from the given list.

6) clear()

The clear() method in Python allows us to remove all the elements from the list making it empty.

Syntax:

It has the following syntax:

Python clear() Method Example

Let us take an example to demonstrate the clear() method in Python.

Example

Compile and Run

Output:

 
Old Shopping List: ['milk', 'bread', 'eggs', 'butter', 'coffee']
New Shopping List: []   

Explanation:

In the above example, we have used the clear() method to remove all the elements from the given list.

7) index()

The index() method in Python returns the first index of the element within start and end.

Syntax:

It has the following syntax:

Python index() Method Example

Let us take an example to demonstrate the index() method in Python.

Example

Compile and Run

Output:

 
Shopping List: ['milk', 'bread', 'eggs', 'butter', 'coffee']
Index of butter: 3   

Explanation:

In the above example, we have used the index() method to find the first occurrence of the element from the given list.

8) count()

The count() method in Python allows us to all the occurrence of the element in the list.

Syntax:

It has the following syntax:

Python count() Method Example

Let us take an example to demonstrate the count() method in Python.

Example

Compile and Run

Output:

 
Shopping List: ['milk', 'bread', 'egg', 'milk', 'butter', 'coffee', 'egg', 'flour', 'egg']
No. of Eggs: 3   

Explanation:

In the above example, we have used the count() method to find all the occurrences of 'egg' in the given list.

9) sort()

The sort() method in Python allows us to sort the list in place.

Syntax:

It has the following syntax:

Python sort() Method Example

Let us take an example to illustrate how the sort() method works in Python.

Example

Compile and Run

Output:

 
Unsorted Fruit Basket: ['mango', 'apple', 'orange', 'banana', 'grapes']
Sorted Fruit Basket: ['apple', 'banana', 'grapes', 'mango', 'orange']   

Explanation:

In the above example, we have used the sort() method to sort the elements of the given list in ascending order.

10) reverse()

The reverse() method in Python allows us to reverse the list in place.

Syntax:

It has the following syntax:

Python reverse() Method Example

Let us take an example to illustrate how the reverse() method works in Python.

Example

Compile and Run

Output:

 
Fruit Basket: ['apple', 'banana', 'grapes', 'mango', 'orange']
Reversed Fruit Basket: ['orange', 'mango', 'grapes', 'banana', 'apple']   

Explanation:

In the above example, we have used the reverse() method to reverse the given list.

11) copy()

The copy() method in Python allows us to create a shallow copy of the list.

Syntax:

It has the following syntax:

Python copy() Method Example

Let us take an example to illustrate how the copy() method works in Python.

Example

Compile and Run

Output:

 
Fruit Basket: ['apple', 'banana', 'grapes', 'mango', 'orange']
Copied Fruit Basket: ['apple', 'banana', 'grapes', 'mango', 'orange']   

Explanation:

In the above example, we have used the copy() method to create a shallow copy of the given list.


Next TopicPython Tuples