Python – Find Largest Element – max() Function with Examples

max() function is used to find the largest element in an iterable or largest of two or more parameters in Python for the given input.

max() function is a part of Python Built-in Functions.

Syntax of max() Function

The syntax of max() function in Python is:

max(iterable, *iterables[,key, default]) max(arg1, arg2, *args[, key])

 

Parameters of max() Function in Python

x – Where x is any valid. This parameter is required.

 

Compatibility

max() function is available and compatible with both Python 2.x and 3.x.

 

Return Value of max() Function in Python

max() function returns the largest element in an iterable or largest of two or more parameters for the given input.

 

Python max() Function Example 1

Example CODE

Output:

 

Python max() Function Example 2

Example CODE

Output: