Web Analytics

Python max() Function

Math Function Maximum

The max() function returns the item with the highest value, or the item with the highest value in an iterable.

If the values are strings, an alphabetically comparison is done.

Syntax

max(n1, n2, n3, ...)

Or

max(iterable)

Parameters

Parameter Description
n1, n2... One or more items to compare
iterable An iterable object containing items to compare

Return Value

The largest item.

Example

Using the max() function:

Output
Click Run to execute your code

Related Functions