Python max() function With Objects
Unlike the max() function of C/C++, the max() function in Python can take any type of object and return the largest among them. In the case of strings, it returns the lexicographically largest value.
Syntax : max(arg1, arg2, *args[, key])
Parameters :
- arg1, arg2 : objects of the same datatype
- *args : multiple objects
- key : function where comparison of iterable is performed based on its return value
Returns : The maximum value
Python – max() function
Python max() function returns the largest item in an iterable or the largest of two or more arguments.
It has two forms.
- max() function with objects
- max() function with iterable