Python3 List max() Method
Description
The max() method returns the largest element in a list.
Syntax
max() method syntax:
max(list)
Parameters
- list -- the list whose largest element is returned.
Return Value
Returns the largest element in the list.
Example
The following example shows how to use the max() function:
Example
#!/usr/bin/python3
list1
,
list2
=
[
'Google'
,
'Runoob'
,
'Taobao'
]
,
[
456
,
700
,
200
]
(
"Largest element in list1: "
,
max
(
list1
)
)
(
"Largest element in list2: "
,
max
(
list2
)
)
The output of the above example is:
list1 最大元素值 : Taobao
list2 最大元素值 : 700
The Python3 list