A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3schools.com/python/ref_func_max.asp below:

Website Navigation


Python max() Function

Python max() Function

❮ Built-in Functions

Definition and Usage

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

Or:

Parameter Values Parameter Description n1, n2, n3, ... One or more items to compare

Or:

Parameter Description iterable An iterable, with one or more items to compare More Examples Example

Return the name with the highest value, ordered alphabetically:

x = max("Mike", "John", "Vicky")

Try it Yourself » Example

Return the item in a tuple with the highest value:

a = (1, 5, 3, 9)
x = max(a)

Try it Yourself » Related Pages

The min() function, to return the lowest value.

❮ Built-in Functions

Track your progress - it's free!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4