# Python max() Function

In this article, we will give you a complete package of Python max function to find the highest value from the iterable ( list, tuple, and set ). I have a large iterable object, Then this will best function to find the highest value from them.

In the previous tutorial, we have seen all about the Python len() function to find the length of the python object.

Contents

## Python max() Function

Python max function is a Python built-in function that returns the highest value from the iterable. If the value is a string, Then an alphabetical comparison will be done.

## Syntax

The syntax of max function in python is:-

``````max(n1, n2, n3)
or
max(iterable)``````

## Parameters

``````n1, n2, n3 represent the numbers to compare.
or
iterable:- An any python iterable to compare the items.``````

## Return Value

Return value of max function in Python is highest value from the iterable or total numbers.

## Python max example

Here we will see some examples to understand python max function.

### Example 1:

``````#Find highest value from the numbers.
result = max(12, 23, 43, 10)
print(result)``````

Output will be:- 43

### Example 2:

``````#Return the name with highest value, order alphabetically.
result = max('Python', 'Java', 'PHP', 'HTML')
print(result)``````

Output will be:- Python

### Example 3:

``````#Find highest value from the list iterable.
my_list = [12, 10, 23, 40, 100]
print(max(my_list))``````

Output will be:- 100

## Conclusion

So here we have learned how to find the highest value from the iterable using the python max function.
You can use multiple values inside the max function separated by a comma to find the highest value from them instead of iterable.
If you like this article, please share and keep visiting for python built-in functions tutorials.

Python built-in functions