Home >>Python Built-in Functions >Python max() Function
Python max() function is used to return the item with the highest value or the item with the highest value in an iterable. If the given input values are strings then an alphabetically comparison is done.
Syntax:max(n1, n2, n3, ...) OR max(iterable)
Parameter | Description |
---|---|
n1, n2, n3, ... | This parameter defines one or more items to compare. |
iterable | This parameter defines an iterable with one or more items to compare. |
x = max(1, 10, 100)
print(x)
a = (1, 15, 31, 19, 5, 55, 13)
x = max(a)
print(x)