Latest web development tutorials

Python min () function

Python figures Python figures


description

min () method returns the minimum value of a given parameter, parameter sequence.


grammar

The following is the syntax min () method:

min( x, y, z, .... )

parameter

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

return value

Back to the minimum value given parameters.

Examples

The following shows an example of the use of min () method:

#!/usr/bin/python

print "min(80, 100, 1000) : ", min(80, 100, 1000)
print "min(-20, 100, 400) : ", min(-20, 100, 400)
print "min(-80, -20, -10) : ", min(-80, -20, -10)
print "min(0, 100, -400) : ", min(0, 100, -400)

After running the above example output is:

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

Python figures Python figures