Python List max() Method
Description
The max() method returns the maximum value among the list elements.
Syntax
Syntax of the max() method:
max(list)
Parameters
- list -- the list whose maximum value is to be returned.
Return Value
Returns the maximum value among the list elements.
Example
The following example demonstrates the usage of the max() function:
#!/usr/bin/python list1, list2 = ['123', 'xyz', 'zara', 'abc'], [456, 700, 200] print "Max value element : ", max(list1); print "Max value element : ", max(list2);
The output of the above example is:
Max value element : zara Max value element : 700Other Extensions
Python Lists