Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python3 max() Function

Python3 max() Function

Python3 Numbers Python3 Numbers


Description

The max() method returns the maximum of the given arguments, which may be a sequence.


Syntax

The syntax of the max() method is as follows:


max( x, y, z, .... )

Parameters


Return Value

Returns the maximum of the given arguments.


Example

The following shows examples of using the max() method:

Example

#!/usr/bin/python3

print

(

"max(80, 100, 1000) : "

,

max

(

80

,

100

,

1000

)

)

print

(

"max(-20, 100, 400) : "

,

max

(

20

,

100

,

400

)

)

print

(

"max(-80, -20, -10) : "

,

max

(

80

,

20

,

10

)

)

print

(

"max(0, 100, -400) : "

,

max

(

0

,

100

,

400

)

)

Running the example above produces:


max(80, 100, 1000) :  1000
max(-20, 100, 400) :  400
max(-80, -20, -10) :  -10
max(0, 100, -400) :  100

Python3 Numbers Python3 Numbers