On this page
  1. max
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

max

Prev: map | Up: __builtins__ | Next: memoryview
Rel: abs, divmod, min, pow, round
Ref: docs.python.org — max
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import max

Overview & Signature

max(iterable, *[, default=obj, key=func]) -> value

max(arg1, arg2, *args, *[, key=func]) -> value With a single iterable argument, return its biggest item. The default keyword-only argument specifies an object to return if

Usage

assert max([3, 9, 1]) == 9
assert max(["a", "ccc", "bb"], key=len) == "ccc"
assert max([], default=-1) == -1

Gotchas

REPL Inspect

help(max)

Linked from

Related notes