Python for Beginners

min() Mathematical function in Python

Python for Beginners | python Tutorial



Overview

min() mathematical function in python is used to find the smallest value out of the parameters passed.

Syntax

The syntax of the min() mathematical function is given below:

								
min(x,x1,x2,. . . .)
								
							

where x,x1,x2,. . . . are numeric value passed as a parameter.

Returns

This mathematical function returns the smallest value of all the parameters x,x1,x2,. . . . passed.

Examples


								
#name of the file: min.py

#min() on float value
print("min(4.52,4.5,4.55,4.2) = ", min(4.52,4.5,4.55,4.2))

#min() on int value
print("min(52,5,55,2) = ", min(52,5,55,2))
								
							


We can run the above code using the following command:
								
>python min.py
min(4.52,4.5,4.55,4.2) =  4.2
min(52,5,55,2) =  2