Python List pop() MethodLast Updated : 11 Apr 2026 In Python, the pop() method is used to remove the element from the list present at the given index. This method also returns the removed element. If the index is unspecified, it will remove and return the last element by default. This method is specifically convenient when we are required to manipulate a list dynamically, as it directly modifies the original list. Syntax of Pop() MethodThe following is the syntax of the pop() method: Parameters
Return
Examples of List pop()We will now take a look at some examples of the list pop() method in Python: Example 1: Simple Use Case of the pop() MethodLet us see a simple example to understand the working of list pop() method. ExampleCompile and RunOutput: Given List: [19, 3, 14, 7, 22, 5] Popped Element: 5 List after Popping: [19, 3, 14, 7, 22] Popped Element: 22 List after Popping: [19, 3, 14, 7] Explanation: In this example, we are given a list consisting some elements. We used the pop() method to remove the element. Since, we have not specified the index value, the last element will be removed. We again performed the same operation. As a result, the pop() method popped the last element from the list, every time it is called. Example 2: Popping the Specific Element from the ListWe will now take a look at an example to understand how to remove a specific element from the list. ExampleCompile and RunOutput: Given List: [19, 3, 14, 7, 22, 5] Popped Element: 14 List after Popping: [19, 3, 7, 22, 5] Popped Element: 19 List after Popping: [3, 7, 22, 5] Explanation: In this example, we are given a list consisting some elements. We used the pop() method to remove the particular element by specifying the index values like 2 and 0, As a result, 14 and 19 is popped from the given list. Example 3: Removing the Elements from the LastWe can remove the elements from the last of the list by specifying the index value as a negative integer. Let us see an example: ExampleCompile and RunOutput: Given List: [19, 3, 14, 7, 22, 5] Popped Element: 5 List after Popping: [19, 3, 14, 7, 22] Popped Element: 3 List after Popping: [19, 14, 7, 22] Explanation: In this example, we are given a list consisting some elements. We used the pop() method to remove the particular element by specifying the index values -1, and -4. As a result, 5 and 3 is popped from the given list. Next TopicPython List insert() Method |
We request you to subscribe our newsletter for upcoming updates.