What is difference between del, remove and pop on Python lists?

Lists are a basic data structure in Python that allows us to store and modify collections of things. The del, remove, and pop methods are used to change and manipulate lists, although they have distinct purposes and behave differently. Let’s look at each of these ways using coding examples to see how they differ.

The del method

The del statement deletes an item or a subset of items from a list by specifying the index or range to be eliminated. It modifies the list as it is.

my_list = [10, 11, 12, 13, 14]
index_to_remove = 3
del my_list[index_to_remove]
print(my_list)
# Delete a slice of items
del my_list[0:2]
print(my_list)

The remove method

The remove method is used to remove the first occurrence of a value in a list. It modifies the list as it is. If the value isn’t present in the list, it gives a “ValueError” saying element x is not present in the list.

my_list = [10, 11, 12, 13, 14]
value_to_remove = 14
my_list.remove(value_to_remove)
print(my_list)

The pop method

The pop method is used to delete and return a specified index item. If no index is specified, it defaults to removing and returning the last item. It modifies the list as it is.

my_list = [10, 11, 12, 13, 14]
# Remove and return the item at index 2
removed_item = my_list.pop(2)
print(removed_item)
print(my_list)
# Remove and return the last item
last_item = my_list.pop()
print(last_item)
print(my_list)

Comparison of list modification methods in Python

This table summarises the important differences between Python list modification methods del, remove, and pop, highlighting their aims, parameters, influence on the list, and return values.

Method

Purpose

Parameters

Returns

del

Delete items by index or slices

Index or slice

No

remove

Remove first occurrence of a specific value

Value to remove

No

pop

Remove and optionally return item by index

Index (default: -1 for last item)

Removed item

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved