Python min() function returns the lowest value in an iterable object or finds the smallest item between two or more parameters.
Find the smallest item between two or more objects
min(n1, n2, n3, ...)
Python min() function example
Simple example code use min() functions, If the values are strings, an alphabetical comparison is done.
Using min() with iterable arguments
Let’s get the smallest item on a list.
number = [3, 2, 8, 5, 10, 6] res = min(number) print("The smallest number is:", res)
The smallest string in a list
The smallest string is: C++
Do comment if you have any doubts or suggestions on this Python basic topic.
Note: IDE: PyCharm 2021.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.