Latest web development tutorials

Python3 max () function

Python3 digital Python3 digital


description

max () method returns the maximum value of a given parameter, parameter sequence.


grammar

The following is the syntax max () method:

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

parameter

  • x - numeric expression.
  • y - numeric expression.
  • z - a numeric expression.

return value

Back to the maximum value of the given parameters.

Examples

The following shows an example of using the max () method:

#!/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))

After running the above example output is:

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

Python3 digital Python3 digital