Python list method max returns the elements from the list with maximum value.
Following is the syntax for max() method −
max(list)
list − This is a list from which max valued element to be returned.
This method returns the elements from the list with maximum value.
The following example shows the usage of max() method.
#!/usr/bin/python list1, list2 = [123, 'xyz', 'zara', 'abc'], [456, 700, 200] print "Max value element : ", max(list1) print "Max value element : ", max(list2)
When we run above program, it produces following result −
Max value element : zara Max value element : 700