---
title: "max"
space: "Student Handbook"
url: "https://portal.cs17.org/student-handbook/python-manual/built-in-functions/max"
updated: "2026-10-05"
---

Returns the largest of several values.

## Synopsis

```python
max(value1, value2, ...)
max(list)
```

## Description

Give `max` two or more values, or one list.

## Parameters

| Name | Meaning |
| --- | --- |
| `values` | Two or more values, or one list. They must be comparable: all numbers, or all strings. |

## Return value

The largest value.

## Example

```python
print(max(3, 7, 1))
print(max(["apple", "pear", "fig"]))
```

It prints:

```text
7
pear
```

## Common mistake

```python
scores = []
print(max(scores))
```

Python stops with:

```text
ValueError: max() iterable argument is empty
```

An empty list has no largest item. Check `if scores:` first.

## See also

[min](/student-handbook/python-manual/built-in-functions/min), [sum](/student-handbook/python-manual/built-in-functions/sum), [len](/student-handbook/python-manual/built-in-functions/len)

[max in the Python documentation](https://docs.python.org/3/library/functions.html#max)
