min(iterable, *, key=None)
min(iterable, *, default, key=None)
min(arg1, arg2, *args, key=None)
Returns the element with the smallest value from those provided to the function.
Parameters
args: If multiple positional arguments are specified, the element with the smallest value is found among them.iterable: An iterable object, such as a list, tuple, set, or dictionary. If a single positional argument is specified, it must be an iterable. The smallest element among its elements is returned.*iterables(optional): Any number of iterations; there can be more than one.key(optional): A key function to which iterations are passed, and the comparison is based on the returned value.default(optional): The default value if the given iterable is empty.
Return Value
- The
min()function returns the smallest element from the iteration.
Examples
numbers = [7, 3, 8, 5, 9, 6]
smallest_number = min(numbers)
print("Smallest number:", smallest_number)
# Result:
# Smallest number: 3