Python min() built-in function
From the Python 3 documentation
Return the smallest item in an iterable or the smallest of two or more arguments.
Introduction
The min()
function is the counterpart to max(). It can be used in two ways:
- With an iterable (like a list or tuple), it returns the smallest item.
- With two or more arguments, it returns the smallest of them.
Examples
Finding the min in an iterable:
numbers = [10, 2, 1, 40, 5]
print(min(numbers)) # Output: 1
letters = ('z', 'b', 'a')
print(min(letters)) # Output: 'a'
Finding the min of several arguments:
print(min(10, 20, 5)) # Output: 5