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

Python min() function

Python min() function

Python Numbers Python Numbers


Description

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


Syntax

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



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


Parameters


Return Value

Returns the minimum of the given arguments.


Example

The following shows examples of using the 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)

Running the example above produces:



min(80, 100, 1000) :  80

min(-20, 100, 400) :  -20

min(-80, -20, -10) :  -80

min(0, 100, -400) :  -400

Python Numbers Python Numbers