Python3 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 from which the maximum value is to be returned.
Return Value
Returns the maximum value among the list elements.
Example
The following example demonstrates how to use the max() function:
Example
#!/usr/bin/python3
list1, list2 = ['Google', 'Example', 'Taobao'], [456, 700, 200]
print ("Maximum value in list1 : ", max(list1))
print ("Maximum value in list2 : ", max(list2))
list1, list2 = ['Google', 'Example', 'Taobao'], [456, 700, 200]
print ("Maximum value in list1 : ", max(list1))
print ("Maximum value in list2 : ", max(list2))
The output of the above example is as follows:
list1 最大元素值 : Taobao list2 最大元素值 : 700Other Extensions
Python3 Lists