In this tutorial, I will explain how to remove the last element from a list in Python. As a developer working on a project for one of my clients, I came across a situation where I needed to remove the last element from a list. This made me explore this topic. I will share my findings in this tutorial with examples.
Remove the Last Element from a List in Python
To remove the last element from a list in Python, you can use the pop() method without any arguments. For example, if you have a list states = [‘California’, ‘Texas’, ‘Florida’, ‘New York’, ‘Illinois’], you can remove the last state by calling states.pop(), which will remove and return ‘Illinois’, updating the list to [‘California’, ‘Texas’, ‘Florida’, ‘New York’].
Read How to Flatten a List of Lists in Python?
1. Use the pop() Method
The pop() method is a built-in function in Python that removes and returns the last element from a list by default. It can also be used to remove and return an element from a specific index. Here’s an example:
cities = ['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix']
removed_city = cities.pop()
print("Removed city:", removed_city)
print("Updated list:", cities)Output:
Removed city: Phoenix
Updated list: ['New York', 'Los Angeles', 'Chicago', 'Houston']You can see the output in the screenshot below.

In this example, we have a list of cities in the United States. By calling the pop() method without any arguments, it removes and returns the last element, which is ‘Phoenix’. The cities list is updated accordingly.
You can also specify an index to remove an element from a specific position using pop(index). For example:
states = ['California', 'Texas', 'Florida', 'New York', 'Illinois']
removed_state = states.pop(2)
print("Removed state:", removed_state)
print("Updated list:", states)Output:
Removed state: Florida
Updated list: ['California', 'Texas', 'New York', 'Illinois']Here, pop(2) removes and returns the element at index 2, which is ‘Florida’. The states list is updated accordingly.
Check out How to Get the Index of an Element in a List in Python?
2. Use Slicing
Another way to remove the last element from a Python list is by using slicing. Slicing allows you to extract a portion of a list by specifying a range of indices. To remove the last element, you can slice the list from the beginning up to the second-to-last element. Here’s an example:
presidents = ['George Washington', 'John Adams', 'Thomas Jefferson', 'James Madison', 'James Monroe']
updated_presidents = presidents[:-1]
print("Updated list:", updated_presidents)Output:
Updated list: ['George Washington', 'John Adams', 'Thomas Jefferson', 'James Madison']You can see the output in the screenshot below.

In this example, presidents[:-1] creates a new list that includes all elements from the beginning of the list up to the second-to-last element. The last element, ‘James Monroe’, is effectively removed.
Read How to Merge Lists Without Duplicates in Python?
3. Use the del Keyword
The del keyword in Python allows you to remove an element from a list by its index. To remove the last element, you can use the index -1 which refers to the last element in the list. Here’s an example:
rivers = ['Mississippi', 'Missouri', 'Colorado', 'Ohio', 'Columbia']
del rivers[-1]
print("Updated list:", rivers)Output:
Updated list: ['Mississippi', 'Missouri', 'Colorado', 'Ohio']You can see the output in the screenshot below.

In this example, del rivers[-1] removes the last element, ‘Columbia’, from the rivers list.
Check out How to Convert String to List in Python?
4. Use List Comprehension
List comprehension is a concise way to create new lists based on existing lists. It can also be used to remove elements from a list. To remove the last element, you can create a new list that includes all elements except the last one. Here’s an example:
mountains = ['Mount Rainier', 'Mount Whitney', 'Mount Elbert', 'Mount Shasta', 'Pikes Peak']
updated_mountains = [mountain for mountain in mountains[:-1]]
print("Updated list:", updated_mountains)Output:
Updated list: ['Mount Rainier', 'Mount Whitney', 'Mount Elbert', 'Mount Shasta']In this example, the list comprehension [mountain for mountain in mountains[:-1]] creates a new list that includes all elements from the mountains list except the last one. The resulting updated_mountains list has the last element, ‘Pikes Peak’, removed.
Read Convert String to List in Python Without Using Split
Example: Remove the Last Student from a Class List
Let’s consider a real-world scenario where you have a list of students in a class, and you need to remove the last student who dropped out. Here’s how you can achieve this using the pop() method:
students = ['Emily Johnson', 'Michael Davis', 'Jessica Thompson', 'David Anderson', 'Sarah Wilson']
dropped_student = students.pop()
print("Dropped student:", dropped_student)
print("Updated class list:", students)Output:
Dropped student: Sarah Wilson
Updated class list: ['Emily Johnson', 'Michael Davis', 'Jessica Thompson', 'David Anderson']In this example, students.pop() removes the last student, ‘Sarah Wilson’, from the students list and returns it. The students list is updated to reflect the current class list after the student has dropped out.
Check out How to Iterate Through a List in Python?
Conclusion
In this tutorial, I helped you to learn how to remove the last element from a list in Python. I explained four methods to achieve this task, such as using the pop() method, using the del keyword , and using list comprehension. I also covered a real-world example.
You can read:
- How to Write a List to a File in Python?
- How to Select Items from a List in Python?
- How to Add Tuples to Lists in Python?

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.