Python List max() Method
The max() method returns the maximum value of the list elements.
Python List max() Syntax
max() method syntax.
max(list)
Python List max() Parameters
- list : The list to return the maximum value.
Python List max() Return Value
Returns the maximum value in the list element.
Python List max() Example#1
The following example demonstrates the use of the max() function.
#!/usr/bin/python3
list1, list2 = ['deepinout', 'apidemos', 'com'], [123, 400, 800]
print ("list1 Maximum element value : ", max(list1))
print ("list2 Maximum element value : ", max(list2))
Output:
Python List max() Example#2
In this example, we want to find the maximum value from the list of characters.
#!/usr/bin/python3
list1 = ['a', '$', 'p', 'I']
maxValue = max(list1)
print(maxValue)
Output: