# Find minimum value from given parameters using min() in Python

Python min() function with Example: In this article, we are going to learn with an example about min() function which is an in-built function in Python.
Submitted by IncludeHelp, on January 19, 2018

## Python - min() function

min() is an in-built function in Python, which may take N number of arguments and returns minimum value of its arguments.

For example, if we provide 3 arguments with the values 20, 10 and 30. min() will return 10 as it is the minimum value among these 3 arguments.

Syntax:

`min(arg1, arg2, arg3, ...)`

Here, arg1, arg2 and arg3 are the arguments which may integer, string etc.

Example:

```    Input arguments are: 20, 10, 30
Output: 10
Because 10 is the smallest argument here.

Input arguments are: “ABC”, “PQR”, “Hello”
Output: “ABC”
Because “ABC” is the minimum argument according
to its length and alphabetically sequences.
```

Source code:

```#Simple example to get min value
#from given arguments

#this will print 10
print "min(20, 10, 30) : ", min(20, 10, 30)
#this will print ABC
print "min('ABC', 'PQR', 'HELLO') : ", min('ABC', 'PQR', 'HELLO')
```

Output

```min(20, 10, 30) :  10
min('ABC', 'PQR', 'HELLO') :  ABC
```

### Finding smallest/minimum alphabet from given string

Yes! It can also be used to get the alphabet of minimum ASCII value from given string.

Syntax:

`min(string)`

In this case, string is an argument. Here, min() will return minimum/smallest alphabet which has lowest ASCII value.

Source code:

```#program to get minimum/smallest
#character from given string

#this will return 'H'
print "min('Hello') : ", min('Hello')
#this will return 'E'
print "min('HELLO') : ", min('HELLO')
#this will return 'e'
print "min('hello') : ", min('hello')
```

Output

```min('Hello') :  H
min('HELLO') :  E
min('hello') :  e
```

TOP Interview Coding Problems/Challenges

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates