If I understood the question correctly, you can use the slicing notation to keep everything except the last item:

record = record[:-1]

But a better way is to delete the item directly:

del record[-1]

Note 1: Note that using record = record[:-1] does not really remove the last element, but assign the sublist to record. This makes a difference if you run it inside a function and record is a parameter. With record = record[:-1] the original list (outside the function) is unchanged, with del record[-1] or record.pop() the list is changed. (as stated by @pltrdy in the comments)

Note 2: The code could use some Python idioms. I highly recommend reading this:
Code Like a Pythonista: Idiomatic Python (via wayback machine archive).

Answer from sebastian on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › remove-last-element-from-list-in-python
Remove Last Element from List in Python - GeeksforGeeks
July 12, 2025 - List comprehension is a concise way to build new lists. To remove the last element, it can use slicing like [x for x in list[:-1]], which creates a new list excluding the last item, keeping the original list unchanged.
Discussions

How do I remove an element from the end of a list without returning the value? (Python)
Can't you just ignore the returning value...? More on reddit.com
🌐 r/learnprogramming
5
2
April 30, 2021
Use the.remove() method to remove the last item from the list.
ellie adam is having issues with: Q;Ugh, I made this list and now it has some invalid pieces in it. Maybe you can help me clean it up. Use the .remove() method to remove the last... More on teamtreehouse.com
🌐 teamtreehouse.com
7
December 13, 2015
Why does remove() work slower for last elements of a list than for the first element?
The remove method must search the list for the index of the element to remove. It does this probably by iterating from the beginning. This part is much more expensive than the actual removal. If you want to benchmark the actual removal use the pop method instead, which takes an index to remove and not the element to remove. More on reddit.com
🌐 r/learnpython
13
8
March 11, 2024
why can't I remove the last element of an array and reverse it this way?
You need to look at the syntax of slicing. It's list[start:stop:step]. So in your first one our start is 0, our stop is the last element and our step is backwards. So from element 0 we step backwards and we have our stop, done didn't encounter any elements so we have an empty list. More on reddit.com
🌐 r/learnpython
4
4
December 15, 2020
🌐
W3Schools
w3schools.com › python › python_lists_remove.asp
Python - Remove List Items
If you do not specify the index, the pop() method removes the last item. ... The del keyword can also delete the list completely.
🌐
Reddit
reddit.com › r/learnprogramming › how do i remove an element from the end of a list without returning the value? (python)
r/learnprogramming on Reddit: How do I remove an element from the end of a list without returning the value? (Python)
April 30, 2021 -

Hi, so I am writing a class for doing some methods on a list.

I already know how to add an element to the end of a list by using the append() method.

However if I want to remove an element from the end of a list, without returning the value, how would I go about that? I know the pop() method can remove an element from the end of a list but it then returns the value of that element. What kind of method can I include in my class that will remove an element from the end of the list?

🌐
Learn Python
learnpython.dev › 02-introduction-to-python › 080-advanced-datatypes › 20-adding-removing-finding
Lists, Part 2 :: Learn Python by Nina Zakharenko
>>> names = ["Nina", "Max"] >>> len(names) 2 >>> names[2] = "Rose" Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: list assignment index out of range · There are a few ways to remove items from a list.
🌐
FavTutor
favtutor.com › blogs › remove-last-element-from-list-python
Remove Last Element from List in Python | FavTutor
October 12, 2023 - Learn how to delete the last element of a Python list using the pop(), slicing, del, and list comprehension methods.
Find elsewhere
🌐
StrataScratch
stratascratch.com › blog › how-to-remove-an-element-from-a-list-in-python
How to Remove an Element from a List in Python - StrataScratch
October 3, 2025 - In order for your solution to be accepted, your solution should be located on the last line of the editor and match the expected output data type listed in the question. ... This solution first sums the number of messages per guest, then ranks them using the dense method to avoid gaps in rank values. It uses no element removal method, but involves column reordering via .pop() and .insert(). In Python, removing items from a list is a fundamental yet crucial skill.
🌐
Quora
quora.com › What-would-be-the-best-approach-to-remove-the-last-item-number-from-a-list-while-iterating-in-Python
What would be the best approach to remove the last item (number) from a list while iterating in Python? - Quora
Answer (1 of 7): The pop() method will remove the last item from a list, regardless of its type. Here is an example showing iteration until the list is empty: [code]>>> nums = [4, 5, 13, -1, 17, 29] >>> while nums: ... print('just removed', nums.pop()) ... just removed 29 just removed 17 ju...
🌐
Reddit
reddit.com › r/learnpython › why does remove() work slower for last elements of a list than for the first element?
r/learnpython on Reddit: Why does remove() work slower for last elements of a list than for the first element?
March 11, 2024 -

So I was performing an experiment on the execution speed of the remove function on different list lengths and on three different positions of the list.

plot of running times

Green, blue and red plots denote the running times of the operation for the last element, middle element and the first element respectively.

Since remove works by shifting the subsequent elements to the left, I'd assume it'd take more time for remove to execute on the first element, k = 0, as the element shifting would be expensive. Then why is removing the last element more time consuming, by a large margin?

Top answer
1 of 4
18
The remove method must search the list for the index of the element to remove. It does this probably by iterating from the beginning. This part is much more expensive than the actual removal. If you want to benchmark the actual removal use the pop method instead, which takes an index to remove and not the element to remove.
2 of 4
4
So, the reason for this is how remove() works. If you run your test with del instead and go by index, you'll get the opposite result, with last element being removed faster than first element. Why? The remove() function is actually quite simple, and you could recreate it with the following code (not actual code since the underlying implementation is in C, but works the same core way): lst = range(100) size = len(lst) target = 5 for i in range(size): if lst[i] == target: del[i] return raise ValueError In other words, remove() works by going through each element one by one from beginning to end and then deleting the value at the first index that has a match, and raises a ValueError if nothing is found. Given that information, the reason why the last elements are slower than earlier elements should be quite obvious...the sooner the match is found in the loop, the faster it deletes it and breaks out of the loop. Elements at the very end of the list mean you have to look through all the initial elements first, and it's all of those equivalency checks that actually takes the time. If you change your program to use del and go by index, you'll find that deleting lst[-1] is faster than deleting lst[0]. In both cases the middle deletion and removal are in the middle, again for hopefully obvious reasons. Hopefully that makes sense!
🌐
DataCamp
datacamp.com › tutorial › python-remove-item-from-list
How to Remove an Item from a List in Python: A Full Guide | DataCamp
August 1, 2024 - If you do not specify the index for the element to remove from the list, the pop() function will remove the last item in the list by default. If you want to remove the first item from a list in Python, you will specify the index as 0 using the ...
🌐
Vultr Docs
docs.vultr.com › python › standard library › list › pop()
Python List pop() - Remove Last Item
November 5, 2024 - Specify the index of the item to remove. Apply the pop() method with the index as an argument. ... fruits = ['apple', 'banana', 'cherry'] removed_fruit = fruits.pop(1) print(removed_fruit) print(fruits) ...
🌐
Facebook
facebook.com › groups › python › posts › 1740545040119386
Which method removes the last element from a list in Python?
Popular groups · Find communities for you · Over 1 billion people across the globe are using Facebook Groups to explore their favorite topics · Log in · Categories · Science & tech · Travel · Animals · Sports & fitness · Entertainment
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python list remove last element
Python List Remove Last Element - Spark By {Examples}
May 31, 2024 - How to remove the last element/item from a list in Python? To remove the last element from the list, you can use the del keyword or the pop() method.
🌐
Java2Blog
java2blog.com › home › python › remove last element from list python
Remove last element from list python - Java2Blog
February 24, 2021 - You can use list.pop() method to remove the last element from the list.
🌐
DEV Community
dev.to › abbhiishek › how-to-remove-element-from-list-python-22d6
How to remove element from list Python - DEV Community
November 16, 2022 - This element_index is also optional. If not passed, the default value the pop method set is -1. That means the last element from the list is returned. We have to make sure that the index is present in the list or its't out of range.If somehow ...
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › List.html
List (Java Platform SE 8 )
July 21, 2026 - The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993. ... c - the Comparator used to compare list elements.
🌐
Facebook
facebook.com › PythonGuides › posts › how-to-remove-the-last-element-from-the-python-list-4-methods › 838607424985467
How to remove the last element from the #Python list [4 ...
PythonGuides. 8,525 likes · 7 talking about this. Follow our series of Python tutorials & Learn Python from various real-time examples, Python tutoria
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-remove-rear-element-from-list
Python - Remove rear element from list - GeeksforGeeks
April 6, 2023 - This approach involves using the built-in method list.remove() to remove the last element from the list by specifying the element to be removed.
🌐
Educative
educative.io › answers › how-to-delete-an-element-from-a-list-in-python
How to delete an element from a list in Python
For this shot, let’s look at how we can delete a value at a certain index with the del keyword: ... The pop method removes an element at a given index and returns its value. The code below shows an example of this: ... Note: The argument passed ...