# Python List Methods Reference: append(), extend(), insert(), remove()

Source: https://devdocs10.com/articles/python/python-list-methods  
By Murat Bo · Published 2026-11-19 · DevDocs10 (https://devdocs10.com)

Python list methods let you add, remove, search, reorder, and copy items in place. They are the everyday tools you use to work with mutable lists, and the most important detail is that many of them change the original list instead of creating a new one. This reference covers each common list method, what it does, and the mistakes people make with them.

> **Difficulty:** Beginner
>
> **Helpful to know first:** basic Python syntax, variables, and how lists store ordered values.

## Python List Methods and What They Do

List methods are functions you call on a list object with dot notation. Some methods return a value, some return `None`, and several modify the list itself.

Here is the shortest useful model: use `append()` to add one item, `extend()` to add many items, `insert()` to add at a position, `remove()` or `pop()` to delete items, and `sort()` or `reverse()` to reorder the list.

Most list methods change the list in place. That means code after the method call sees the updated list.

```python
fruits = ["apple", "banana"]
fruits.append("cherry")
print(fruits)  # Output: ['apple', 'banana', 'cherry']
```

That example shows the basic pattern. The method runs on the list, and the list itself changes.

## Common Python List Methods You Will Use Often

### append() adds one item to the end

Use `append()` when you want to add a single item to the end of a list. The item can be any Python object, including another list.

```python
numbers = [1, 2]
numbers.append(3)
print(numbers)  # Output: [1, 2, 3]
```

If you append a list, the whole list becomes one item.

```python
items = [1, 2]
items.append([3, 4])
print(items)  # Output: [1, 2, [3, 4]]
```

### extend() adds every item from another iterable

Use `extend()` when you want to add multiple items one by one. Unlike `append()`, it does not nest the argument as a single item.

```python
items = [1, 2]
items.extend([3, 4])
print(items)  # Output: [1, 2, 3, 4]
```

Strings are iterable too, so `extend()` will add each character separately.

```python
letters = ["a"]
letters.extend("bc")
print(letters)  # Output: ['a', 'b', 'c']
```

### insert() adds an item at a chosen index

Use `insert(index, item)` when the new item needs to go somewhere specific. Items at and after the index move one position to the right.

```python
colors = ["red", "blue"]
colors.insert(1, "green")
print(colors)  # Output: ['red', 'green', 'blue']
```

If the index is larger than the list length, Python inserts at the end. If it is negative, Python counts from the end.

```python
colors = ["red", "blue"]
colors.insert(99, "yellow")
print(colors)  # Output: ['red', 'blue', 'yellow']
```

### remove() deletes the first matching value

Use `remove(value)` when you know the item value, not the index. It removes only the first matching element.

```python
pets = ["cat", "dog", "cat"]
pets.remove("cat")
print(pets)  # Output: ['dog', 'cat']
```

If the value is not present, Python raises a `ValueError`.

### pop() removes and returns an item by index

Use `pop()` when you want to remove an item and keep it in a variable. Without an argument, it removes the last item.

```python
tasks = ["email", "call", "code"]
done = tasks.pop()
print(done)
print(tasks)  # Output: code / ['email', 'call']
```

With an index, `pop()` removes that position and returns the removed value.

```python
tasks = ["email", "call", "code"]
print(tasks.pop(1))  # Output: call
print(tasks)  # Output: ['email', 'code']
```

> A common pattern is to use `pop()` when you need the removed item later, and `remove()` when you only care that it disappears.

### clear() removes everything

Use `clear()` when you want the same list object to become empty.

```python
values = [10, 20]
values.clear()
print(values)  # Output: []
```

### index() finds the position of the first match

Use `index(value)` to find where a value first appears.

```python
words = ["one", "two", "two"]
print(words.index("two"))  # Output: 1
```

If the value is missing, Python raises `ValueError`.

### count() counts how many times a value appears

Use `count(value)` to count matching items.

```python
scores = [5, 5, 7]
print(scores.count(5))  # Output: 2
```

## List Methods for Reordering and Copying

### sort() orders the list in place

Use `sort()` when you want the original list sorted. By default, it sorts in ascending order.

```python
numbers = [3, 1, 2]
numbers.sort()
print(numbers)  # Output: [1, 2, 3]
```

You can sort in reverse order with `reverse=True`.

```python
numbers = [3, 1, 2]
numbers.sort(reverse=True)
print(numbers)  # Output: [3, 2, 1]
```

You can also sort by a key function, such as string length.

```python
words = ["pear", "fig", "banana"]
words.sort(key=len)
print(words)  # Output: ['fig', 'pear', 'banana']
```

### reverse() flips the order in place

Use `reverse()` when you want to reverse the current order without making a copy.

```python
letters = ["a", "b", "c"]
letters.reverse()
print(letters)  # Output: ['c', 'b', 'a']
```

### copy() makes a shallow copy

Use `copy()` when you want a new list object with the same items. This is a shallow copy, so nested mutable objects are still shared.

```python
original = [[1], [2]]
copied = original.copy()
copied[0].append(99)
print(original)  # Output: [[1, 99], [2]]
print(copied)  # Output: [[1, 99], [2]]
```

That result surprises many beginners. `copy()` makes a new outer list, but it does not clone the nested inner lists.

## How Python List Methods Behave in Detail

### Most list methods mutate the original list

The biggest idea to understand is mutation. If two variables point to the same list, a method call through one name affects the other name too.

```python
a = [1, 2]
b = a
b.append(3)
print(a)  # Output: [1, 2, 3]
print(b)  # Output: [1, 2, 3]
```

This is why list methods are called in-place operations. They do not create a fresh list unless the method documentation says otherwise, such as `copy()`.

### Some methods return a value and some return None

Methods like `append()`, `sort()`, `reverse()`, and `clear()` return `None`. This is a design choice that helps show they are meant to modify the list, not build a new one.

```python
numbers = [3, 1]
result = numbers.sort()
print(result)  # Output: None
print(numbers)  # Output: [1, 3]
```

If you assign the result of `sort()` or `append()` to a variable, that variable becomes `None`. The list still changes, but the method itself does not hand back the list.

### Negative indexes work in several methods

Methods that take an index, such as `insert()` and `pop()`, understand negative indexes. In Python, `-1` means the last item, `-2` means the item before that, and so on.

```python
letters = ["a", "b", "c"]
print(letters.pop(-1))  # Output: c
print(letters)  # Output: ['a', 'b']
```

### sort() changes the original order, while sorted() makes a new list

`sort()` is a list method. The built-in `sorted()` function works on any iterable and returns a new list.

```python
numbers = [3, 1, 2]
new_numbers = sorted(numbers)
print(numbers)      # Output: [3, 1, 2]
print(new_numbers)  # Output: [1, 2, 3]
```

Use `sorted()` when you want to keep the original list unchanged.

## Python List Methods and Related Errors

Several list methods raise errors when the list does not contain the item or index you asked for. These are normal Python errors and usually mean your code asked for something that is not there.

### ValueError from remove() when the value is missing

If you call `remove()` with a value that is not in the list, Python raises `ValueError: list.remove(x): x not in list`.

```python
numbers = [1, 2]
numbers.remove(3)
```

> This error means the value does not exist in the list at the moment you tried to remove it.

The usual fix is to check first or use a `try`/`except` block if missing values are normal.

### IndexError from pop() when the index is out of range

If you use an index that is too large or too small for the current list, `pop()` raises `IndexError: pop index out of range`.

```python
items = ["a"]
items.pop(5)
```

The fix is to make sure the index is valid before you call `pop()`, especially in loops.

### TypeError from using non-iterables with extend()

`extend()` needs an iterable. If you pass a single integer or another non-iterable value, Python raises a `TypeError`.

```python
numbers = [1, 2]
numbers.extend(3)
```

The fix is to wrap the value in a list if you mean to add one item: `numbers.extend([3])`.

### AttributeError when calling a list method on the wrong object

Sometimes the problem is not the method itself but the object. If a variable no longer holds a list, list methods are unavailable.

```python
items = [1, 2]
items = items.append(3)
print(items.append(4))
```

This happens because `append()` returns `None`, so the variable stops being a list. The fix is to call the method on its own line and keep the original list variable unchanged.

## Common Python List Method Mistakes

### Using append() when you meant extend()

Beginners often want to add several items, but `append()` adds only one item. If that item is itself a list, the result is a nested list.

**Problem:** The code adds the whole list as one element, so later loops and indexing behave differently from what the writer expected.

```python
numbers = [1, 2]
numbers.append([3, 4])
print(numbers)  # Output: [1, 2, [3, 4]]
```

**Fix:** Use `extend()` when you want the new values added one by one.

```python
numbers = [1, 2]
numbers.extend([3, 4])
print(numbers)  # Output: [1, 2, 3, 4]
```

The corrected version works because `extend()` iterates over the argument instead of nesting it.

### Assigning the result of append() or sort()

Some list methods return `None`. If you assign that result back to the same variable, you lose the list reference.

**Problem:** The variable no longer refers to a list after the assignment, so list methods fail later with an `AttributeError`.

```python
items = [3, 1]
items = items.sort()
print(items)  # Output: None
```

**Fix:** Call the method without reassigning its return value.

```python
items = [3, 1]
items.sort()
print(items)  # Output: [1, 3]
```

The corrected version works because the list stays in the variable, and `sort()` does its job in place.

### Calling remove() without checking whether the value exists

If the value may or may not be present, `remove()` can fail at runtime.

**Problem:** The code assumes the value is always there, but missing values cause `ValueError`.

```python
names = ["Ada", "Linus"]
names.remove("Grace")
```

**Fix:** Check first, or handle the error when missing values are expected.

```python
names = ["Ada", "Linus"]
target = "Grace"
if target in names:
    names.remove(target)
print(names)  # Output: ['Ada', 'Linus']
```

The corrected version works because it only removes values that are actually present.

## Predict the Output

### append() versus extend()

What does this print?

```python
a = [1, 2]
b = a
b.append([3, 4])
print(a)
```

**Answer:**

`a` and `b` refer to the same list. `append()` adds one item, and that one item is the nested list `[3, 4]`. So the list printed by `a` becomes `[1, 2, [3, 4]]`.

```bash
# Output: [1, 2, [3, 4]]
```

### sort() returns None

What happens here?

```python
values = [3, 1, 2]
result = values.sort()
print(result, values)
```

**Answer:**

`sort()` changes the list in place and returns `None`. After the call, `values` is sorted, but `result` is `None`.

```bash
# Output: None [1, 2, 3]
```

## Find the Bug

Find the bug in this code that tries to move the newest item to the front of the list.

```python
def move_newest_to_front(items):
    newest = items.pop()
    items.insert(1, newest)
    return items

print(move_newest_to_front([10, 20, 30]))
```

**Answer:**

The bug is the insertion index. After `pop()`, the newest value should be inserted at index `0`, not `1`. Index `1` puts it into the second position.

**Fixed code:**

```python
def move_newest_to_front(items):
    newest = items.pop()
    items.insert(0, newest)
    return items

print(move_newest_to_front([10, 20, 30]))  # Output: [30, 10, 20]
```

The fixed version works because index `0` means the front of the list.

## When to Use Each List Method

Use the method that matches the kind of change you want. The main choice is often not between two list methods, but between a mutating method and a non-mutating alternative.

| Need | Use | Why |
| --- | --- | --- |
| Add one item | `append()` | Fast and clear for a single value. |
| Add many items | `extend()` | Adds each element separately. |
| Insert at a position | `insert()` | Lets you control the index. |
| Remove by value | `remove()` | Good when you know the item, not its position. |
| Remove and reuse the value | `pop()` | Returns the removed item. |
| Sort in place | `sort()` | Changes the original list. |
| Need a sorted copy | `sorted()` | Leaves the original list unchanged. |

> If you are unsure whether a method mutates the list, check whether it returns a new list or `None`. That is often the clearest clue.

## List Methods Most Often Misused

### append() versus extend()

People confuse these because both add data to a list. The difference is depth: `append()` adds one object, while `extend()` walks through an iterable and adds each item separately.

```python
a = [1]
a.append([2, 3])
print(a)  # Output: [1, [2, 3]]

b = [1]
b.extend([2, 3])
print(b)  # Output: [1, 2, 3]
```

`append()` is for one item. `extend()` is for many items.

### remove() versus pop()

`remove()` deletes by value. `pop()` deletes by position and returns the removed item. If you need the value after deletion, `pop()` is the better choice.

```python
values = ["a", "b", "c"]
print(values.pop(1))  # Output: b
print(values)  # Output: ['a', 'c']
```

`remove()` is better when you know the exact value and do not need it back.

### sort() versus sorted()

Use `sort()` when the list itself should become ordered. Use `sorted()` when you want a new sorted list and want to preserve the original.

```python
scores = [50, 20, 40]
copy_scores = sorted(scores)
print(scores)       # Output: [50, 20, 40]
print(copy_scores)  # Output: [20, 40, 50]
```

The choice matters most when other code still needs the original order.

## Predict the Output

### Shared lists and in-place changes

What does this print?

```python
left = [1, 2]
right = left
right.clear()
print(left)
```

**Answer:**

Both names point to the same list object. `clear()` empties that list in place, so `left` also becomes empty.

```bash
# Output: []
```

## Summary

- List methods usually change the original list in place.
- `append()` adds one item, while `extend()` adds items from an iterable.
- `insert()` adds at a specific index, and `pop()` removes by index and returns the removed value.
- `remove()` deletes the first matching value and raises `ValueError` if the value is missing.
- `sort()` and `reverse()` mutate the list, while `sorted()` returns a new list.
- `copy()` makes a shallow copy, so nested mutable items are still shared.

Next, read about Python list slicing to see how to copy, skip, and replace ranges of items without using methods.
