min() function of list in Python

The min() function returns the smallest of the elements present in a Python list. The Python example creates a list of integers and prints the smallest of them as output.

List Updated 21 Jul 2021 1 min read

Overview

  • The min() function returns the smallest of the elements present in a Python list.

Example

python
# Example Python program that constructs

            # a Python list of integers and returns the smallest of

            # the elements

# Construct a Python list object

            elems = [10, 20, 60, 70, 5, 40, 30]

# Find the smallest of the elements

            smallestElement = min(elems)

print("Unordered elements from a Python list:")

            print(elems)

print("Smallest of the elements:")

            print(smallestElement)

Output

Output
Unordered elements from a Python list:

[10, 20, 60, 70, 5, 40, 30]

Smallest of the elements:

5