---
title: "list.pop"
space: "Student Handbook"
url: "https://portal.cs17.org/student-handbook/python-manual/lists/pop"
updated: "2026-10-05"
---

Removes an item from a list and returns it.

## Synopsis

```python
items.pop()
items.pop(index)
```

## Description

Without an index, `pop` removes the last item. With an index, it removes the item at that position.

## Parameters

| Name | Meaning |
| --- | --- |
| `index` | Which position to remove. Optional. The default is the last item. |

## Return value

The item that was removed.

## Example

```python
stack = ["a", "b", "c"]
last = stack.pop()
print(last)
print(stack)
first = stack.pop(0)
print(first, stack)
```

It prints:

```text
c
['a', 'b']
a ['b']
```

## Common mistake

```python
items = []
items.pop()
```

Python stops with:

```text
IndexError: pop from empty list
```

An empty list has nothing to remove. Check `if items:` first.

## See also

[list.append](/student-handbook/python-manual/lists/append), [Indexing and slicing](/student-handbook/python-manual/lists/indexing-and-slicing)

[list.pop in the Python documentation](https://docs.python.org/3/tutorial/datastructures.html#more-on-lists)
