{"id":9998,"date":"2021-03-13T20:28:00","date_gmt":"2021-03-13T14:58:00","guid":{"rendered":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/?p=9998"},"modified":"2021-05-26T16:58:57","modified_gmt":"2021-05-26T11:28:57","slug":"python-min","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/","title":{"rendered":"8 Examples to Use Python min() Function in the Best Way"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Introduction\" title=\"Introduction\">Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/python-min\/#What_is_min_in_python\" title=\"What is min() in python?\">What is min() in python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Syntax_of_Python_min\" title=\"Syntax of Python min()\">Syntax of Python min()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Parameter\" title=\"Parameter\">Parameter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Return_value_of_Python_min_Function\" title=\"Return value of Python min() Function\">Return value of Python min() Function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Exceptions\" title=\"Exceptions\">Exceptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Examples\" title=\"Examples\">Examples<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python-min\/#1_using_Python_min_function_in_string\" title=\"1. using Python min() function in string\">1. using Python min() function in string<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/python-min\/#2_using_Python_min_function_in_list_of_integers\" title=\"2. using Python min() function in list of integers\">2. using Python min() function in list of integers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/python-min\/#3_using_min_function_in_list_of_strings\" title=\" 3. using min() function in list of strings\"> 3. using min() function in list of strings<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/python-min\/#4_using_Python_min_function_in_tuple\" title=\"4. using Python min() function in tuple\">4. using Python min() function in tuple<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/python-min\/#5_using_min_function_in_dictionary\" title=\"5. using min() function in dictionary\">5. using min() function in dictionary<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/python-min\/#6_using_Python_min_function_with_a_default_value\" title=\"6. using Python min() function with a default value\">6. using Python min() function with a default value<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/python-min\/#7_using_min_function_with_arguments_and_key_function\" title=\"7. using min() function with arguments and key function\">7. using min() function with arguments and key function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pythonpool.com\/python-min\/#8_using_Python_min_function_with_multiple_iterables\" title=\"8. using Python min() function with multiple iterables\">8. using Python min() function with multiple iterables<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-introduction\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python has several built-in functions. These all functions are the global functions of python, which can be called from python code. We do not have to import any library for it. In this tutorial, wie will be studying the <strong>min() function<\/strong> in python. There are a lot of functions in python like <a href=\"https:\/\/www.pythonpool.com\/python-max-function\/\" target=\"_blank\" rel=\"noreferrer noopener\">max()<\/a>, <a href=\"https:\/\/www.pythonpool.com\/python-absolute-value\/\" target=\"_blank\" rel=\"noreferrer noopener\">abs()<\/a>, <a href=\"https:\/\/www.pythonpool.com\/python-next\/\" target=\"_blank\" rel=\"noreferrer noopener\">next()<\/a>,<a href=\"https:\/\/www.pythonpool.com\/python-power\/\" target=\"_blank\" rel=\"noreferrer noopener\"> pow()<\/a>, etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-min-in-python\"><span class=\"ez-toc-section\" id=\"What_is_min_in_python\"><\/span>What is min() in python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The min() function in python is used to return the minimum values passed in its argument and lexicographically smallest value if the strings are passed as arguments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-syntax-of-python-min\"><span class=\"ez-toc-section\" id=\"Syntax_of_Python_min\"><\/span>Syntax of Python min()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>min(iterables, key,default)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-parameter\"><span class=\"ez-toc-section\" id=\"Parameter\"><\/span>Parameter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul><li><strong>Iterables<\/strong> &#8211; It is the type of objects like list, tuple, dictionary, etc.<\/li><li><strong>Key<\/strong> &#8211; It is optional input in the min() function. This is the parameter where the iterables are passed, and the comparison is performed.<\/li><li><strong>Default<\/strong> &#8211; It is also the optional input in the min() function. In this, we pass the default value if the given iterable is empty.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-return-value-of-python-min-function\"><span class=\"ez-toc-section\" id=\"Return_value_of_Python_min_Function\"><\/span>Return value of Python min() Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It returns the minimum value from the iterables passed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-exceptions\"><span class=\"ez-toc-section\" id=\"Exceptions\"><\/span>Exceptions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It also returns exceptions sometimes when we used to compare the conflicting types of iterables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-examples\"><span class=\"ez-toc-section\" id=\"Examples\"><\/span>Examples<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let us understand the min() function of python in details with the help of examples:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-using-python-min-function-in-string\"><span class=\"ez-toc-section\" id=\"1_using_Python_min_function_in_string\"><\/span>1. using Python min() function in string<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be taking the input as a string and finding the string&#8217;s minimum value.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using input as a string\n\nstr = &quot;LatrAcaLsSolutions&quot;\nMinimum = min(str)\n\nprint(&quot;Minimum value in the string: &quot;, Minimum)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Minimum value in the string :  A<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as a string. Secondly, we will apply the min() function and store the output in the Minimum variable. At last, we will print the output. Hence, we will see the minimum value in the string.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-using-python-min-function-in-list-of-integers\"><span class=\"ez-toc-section\" id=\"2_using_Python_min_function_in_list_of_integers\"><\/span>2. using Python min() function in list of integers<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be taking the input as a list containing integer values in it. Then, we will try to find the minimum value of the integer in the list.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using a list of integers\n\nlst = &#x5B;5, 4, -5, 0, 4]\nminimum = min(lst)\nprint(&quot;Minimum in the list is : &quot;,minimum)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Minimum in the list is :  -5<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as a list of integers. Secondly, we will apply the min() and store the output in the minimum variable. At last, we will print the output. Hence, we will see the minimum value in the list of integers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-using-min-function-in-list-of-strings\"><span class=\"ez-toc-section\" id=\"3_using_min_function_in_list_of_strings\"><\/span> 3. using min() function in list of strings<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be taking the input as a list containing string values in it. Then, we will try to find the minimum value of the string in the list.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using a list of string\n\nlst = &#x5B;&quot;Latracal&quot;, &quot;Solutions&quot;, &quot;USA&quot;]\nminimum = min(lst)\nprint(&quot;Minimum in the list is : &quot;,minimum)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Minimum in the list is :  USA<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as a list of strings. Secondly, we will apply the min() and store the output in the Minimum variable. At last, we will print the output. Hence, we will see the minimum value in the list of strings.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-4-using-python-min-function-in-tuple\"><span class=\"ez-toc-section\" id=\"4_using_Python_min_function_in_tuple\"><\/span>4. using Python min() function in tuple<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be taking the input as a tuple. Then, we will try to find the minimum value present in the tuple.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using tuple as an input\n\narr = (1, 5, 3, 9)\nMIN = min(arr)\n\nprint(&quot;minimum value : &quot;,MIN)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>minimum value :  1<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as a tuple. Secondly, we will apply the min() and store the output in the Minimum <a href=\"https:\/\/en.wikipedia.org\/wiki\/Variable\" target=\"_blank\" rel=\"noreferrer noopener\">variable<\/a>. At last, we will print the output. Hence, we will see the minimum value in the tuple.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-5-using-min-function-in-dictionary\"><span class=\"ez-toc-section\" id=\"5_using_min_function_in_dictionary\"><\/span>5. using min() function in dictionary<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be taking the input as a dictionary. Then, we will try to find the minimum value present in the dictionary.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using a dictionary as input\n\ndict = {1: 4, 2: 9, 3: 1, 4: 4}\nMIN = min(dict)\n\nprint(&quot;Minimum value : &quot;,MIN)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Minimum value :  1<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as a dictionary. Secondly, we will apply the min() function and store the output in the MIN variable. At last, we will print the output. Hence, we will see the minimum value in the dictionary.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-6-using-python-min-function-with-a-default-value\"><span class=\"ez-toc-section\" id=\"6_using_Python_min_function_with_a_default_value\"><\/span>6. using Python min() function with a default value<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be taking the input as an empty list. Then, we will try to find the minimum empty list with the default value.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using default value\n\nlst = &#x5B;]\nx= min(lst, default =20)\n\nprint(&quot;Minimum value : &quot;,x)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Minimum value :  20<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as an empty list as lst= []. Secondly, we will apply the min() function with the default value = 20  and store the x variable&#8217;s output. At last, we will print the output. Hence, we will see the minimum value in the empty string with the default value = 20.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-7-using-min-function-with-arguments-and-key-function\"><span class=\"ez-toc-section\" id=\"7_using_min_function_with_arguments_and_key_function\"><\/span>7. using min() function with arguments and key function<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be using min() with arguments and key function. we will define the function for calculating the string&#8217;s length.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using the key function\n\ndef str_length(s):\n    return len(s)\nlst = &#x5B;'LAtra', 'abc', 'Solu']\nx = min(lst)\n\nprint(x, key=str_length))\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>abc<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as a list. Secondly, we will apply the min() function and store the output in the x variable. Thirdly, we will define the def function with str_length(s) as the name of it. Fourthly, we will try to print the min value with the key value = str_length. At last, we will print the output. Hence, we will see the minimum value in the string.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-8-using-python-min-function-with-multiple-iterables\"><span class=\"ez-toc-section\" id=\"8_using_Python_min_function_with_multiple_iterables\"><\/span>8. using Python min() function with multiple iterables<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this example, we will be using the multiple iterables as the input. Then we will print the minimum value of the iterables.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#using multiple iterables\n\nlst1 = &#x5B;1, 2, 3]\nlst2 = &#x5B;5, 15, 40, 25, 35, 45]\nMinimum = min(lst1, lst2, key = len)\nprint(&quot;Minimum value : &quot;, Minimum)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Minimum value :  &#91;1, 2, 3]<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>Here firstly, we will take the input as multiple iterables with two lists as lst1 and lst2. Secondly, we will apply the min() function with both the list and the key-value = len. Thirdly, we will store the output in the Minimum variable. At last, we will print the output. Hence, we will see the minimum value in the tuple.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this tutorial, we have learned how to calculate the minimum value using the min() python function. All the parameters and types are explained in detail with the help of examples. You can use any data such as list, tuple, dictionary, etc., as required. You can also use different types of parameters as required in the program.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Python has several built-in functions. These all functions are the global functions of python, which can be called from python code. We do not &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"8 Examples to Use Python min() Function in the Best Way\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/python-min\/#more-9998\" aria-label=\"More on 8 Examples to Use Python min() Function in the Best Way\">Read more<\/a><\/p>\n","protected":false},"author":17,"featured_media":10053,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[3725,3723,3722,3721,3724],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v22.4) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>8 Examples to Use Python min() Function in the Best Way - Python Pool<\/title>\n<meta name=\"description\" content=\"The python min() function is used to return the minimum values passed in its argument and lexicographically smallest value if the strings is passed.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/python-min\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"8 Examples to Use Python min() Function in the Best Way\" \/>\n<meta property=\"og:description\" content=\"Introduction Python has several built-in functions. These all functions are the global functions of python, which can be called from python code. We do\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python-min\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-13T14:58:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-26T11:28:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Siddharth Jain\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siddharth Jain\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/\"},\"author\":{\"name\":\"Siddharth Jain\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/75a3240fabe5ea90200777a9d8d3b4fa\"},\"headline\":\"8 Examples to Use Python min() Function in the Best Way\",\"datePublished\":\"2021-03-13T14:58:00+00:00\",\"dateModified\":\"2021-05-26T11:28:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/\"},\"wordCount\":947,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png\",\"keywords\":[\"min function python\",\"min python\",\"min() python\",\"python min function\",\"python min key\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/python-min\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/\",\"url\":\"https:\/\/www.pythonpool.com\/python-min\/\",\"name\":\"8 Examples to Use Python min() Function in the Best Way - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png\",\"datePublished\":\"2021-03-13T14:58:00+00:00\",\"dateModified\":\"2021-05-26T11:28:57+00:00\",\"description\":\"The python min() function is used to return the minimum values passed in its argument and lexicographically smallest value if the strings is passed.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/python-min\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png\",\"width\":1350,\"height\":650,\"caption\":\"python min\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/python-min\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"8 Examples to Use Python min() Function in the Best Way\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/75a3240fabe5ea90200777a9d8d3b4fa\",\"name\":\"Siddharth Jain\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/46e774729027d25817fb19483e28dd4a?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/46e774729027d25817fb19483e28dd4a?s=96&d=wavatar&r=g\",\"caption\":\"Siddharth Jain\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"8 Examples to Use Python min() Function in the Best Way - Python Pool","description":"The python min() function is used to return the minimum values passed in its argument and lexicographically smallest value if the strings is passed.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/","og_locale":"en_US","og_type":"article","og_title":"8 Examples to Use Python min() Function in the Best Way","og_description":"Introduction Python has several built-in functions. These all functions are the global functions of python, which can be called from python code. We do","og_url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/","og_site_name":"Python Pool","article_published_time":"2021-03-13T14:58:00+00:00","article_modified_time":"2021-05-26T11:28:57+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png","type":"image\/png"}],"author":"Siddharth Jain","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Siddharth Jain","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/"},"author":{"name":"Siddharth Jain","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#\/schema\/person\/75a3240fabe5ea90200777a9d8d3b4fa"},"headline":"8 Examples to Use Python min() Function in the Best Way","datePublished":"2021-03-13T14:58:00+00:00","dateModified":"2021-05-26T11:28:57+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/"},"wordCount":947,"commentCount":0,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png","keywords":["min function python","min python","min() python","python min function","python min key"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/","url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/","name":"8 Examples to Use Python min() Function in the Best Way - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#primaryimage"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png","datePublished":"2021-03-13T14:58:00+00:00","dateModified":"2021-05-26T11:28:57+00:00","description":"The python min() function is used to return the minimum values passed in its argument and lexicographically smallest value if the strings is passed.","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/03\/Examples-to-Use-Python-min-Function-in-the-Best-Way.png","width":1350,"height":650,"caption":"python min"},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/python-min\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"8 Examples to Use Python min() Function in the Best Way"}]},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/twitter.com\/pythonpool","https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#\/schema\/person\/75a3240fabe5ea90200777a9d8d3b4fa","name":"Siddharth Jain","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/secure.gravatar.com\/avatar\/46e774729027d25817fb19483e28dd4a?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/secure.gravatar.com\/avatar\/46e774729027d25817fb19483e28dd4a?s=96&d=wavatar&r=g","caption":"Siddharth Jain"}}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9998"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=9998"}],"version-history":[{"count":13,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9998\/revisions"}],"predecessor-version":[{"id":12526,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9998\/revisions\/12526"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/10053"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=9998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=9998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=9998"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20240926032922\/https:\/\/api.w.org\/{rel}","templated":true}]}}