{"id":24826,"date":"2021-11-02T09:54:32","date_gmt":"2021-11-02T04:24:32","guid":{"rendered":"https:\/\/python-programs.com\/?p=24826"},"modified":"2021-11-05T20:38:05","modified_gmt":"2021-11-05T15:08:05","slug":"python-min-function-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-min-function-with-examples\/","title":{"rendered":"Python min() Function with Examples"},"content":{"rendered":"

In the previous article, we have discussed Python max() Function with Examples<\/a>
\nmin() Function in Python:<\/strong><\/p>\n

The min() function returns the item with the lowest value or the item in an iterable with the lowest value.<\/p>\n

If the values are strings, they are compared alphabetically.<\/p>\n

Syntax:<\/strong><\/p>\n

min(iterable)<\/pre>\n

or<\/p>\n

min(n1, n2, n3,........)<\/pre>\n

Parameters<\/strong><\/p>\n

iterable:<\/strong> An iterable that compares one or more items.<\/p>\n

n1, n2, n3,……..:<\/strong> a single or multiple items to compare.<\/p>\n

Return Value:<\/strong><\/p>\n

min() returns the iterable’s smallest element.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List = [1, 2, 5, 6, 15, 7]<\/pre>\n

Output:<\/strong><\/p>\n

The smallest number in the given list = 1<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List = [\"hello\", \"this\", \"is\", \"btechgeeks\"]<\/pre>\n

Output:<\/strong><\/p>\n

The smallest string in the given list (alphabetically ordered) is :\r\nbtechgeeks<\/pre>\n

Note:<\/strong><\/p>\n

If the items in an iterable are strings, the smallest(alphabetically ordered) \r\nitem is returned.<\/pre>\n

min() Function with Examples in Python<\/h2>\n