Python min() function

The min() function in Python returns the item with the lowest value or the item with the lowest value in the specified iterable. If the given values are strings, an alphabetical comparison is done.

Syntax

or

Parameter

arg1, arg2, *args : This parameter represents one or more items to compare.

iterable: This parameter represents an iterable, with one or more items to compare.

Return

This function returns the smallest item in an iterable or the smallest of two or more arguments.

Raises

If the iterable is empty and the default is not provided, a ValueError is raised.

Example 1

Output

Example 2

Output

 

Pin It on Pinterest

Share This