Python Min() Function With Example

09-Dec-2021

.

Admin

Python Min() Function With Example

Hello Friends,

I would like to share with you how to use min() function in python. we will learn about the Python min() function. I am going show you python min() function example.

Python min() function returns the largest item in an iterable or the largest of two or more arguments. The min() function returns the item with the highest value.

Here I will give example for use of min() function using python. So let's see the below example:

Syntax:


min (num1, num2, num3, ...)

Example : 1

minNum = min(1,51,16,61,9,10,15)

print(minNum)

Output:

1

Example : 2

numList = [5, 16, 151, 850, 456, 115, 444, 989, 102]

print("The min Value in List : ", min(numList))

Output:

The min Value in List : 5

Example : 3

color = ['orange', 'pink', 'black', 'red']

print("The min color is : ", min(color))

Output:

The min color is : black

Example : 4

list = [[6, 8], [1, 2], [5, 4],[8,9]]

print("The minimum Value : ", min(list))

Output:

The minimum Value : [1, 2]

It will help you....

#Python