{"id":9998,"date":"2021-03-13T20:28:00","date_gmt":"2021-03-13T14:58:00","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=9998"},"modified":"2026-07-13T12:32:41","modified_gmt":"2026-07-13T07:02:41","slug":"python-min","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/python-min\/","title":{"rendered":"Python min(): Find the Smallest Value Safely"},"content":{"rendered":"<p><strong>Quick answer:<\/strong> Call min(iterable) or min(value1, value2, &#8230;). Use key to compare objects by a field, default when an empty iterable is valid, and remember that ties return the first minimum encountered.<\/p>\n<figure class=\"pythonpool-article-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-min-1.png\" alt=\"Python min infographic comparing iterable input, multiple arguments, key functions, default, and empty sequences\" width=\"1536\" height=\"1024\" loading=\"lazy\" decoding=\"async\"><figcaption>min can compare an iterable or several arguments; key controls the comparison field and default defines what happens when no values exist.<\/figcaption><\/figure>\n<p>The Python <code>min()<\/code> function returns the smallest item from an iterable or the smallest of several arguments. It is the standard built-in tool for finding minimum values in ordinary Python data.<\/p>\n<p>The official Python documentation covers <a href=\"https:\/\/docs.python.org\/3\/library\/functions.html#min\">min()<\/a>.<\/p>\n<p>Use <code>min()<\/code> when the data is already in memory and you need one smallest item. Use NumPy tools for array-heavy numeric work, and use a heap when you repeatedly need the smallest item from a changing collection.<\/p>\n<p>The examples below cover the common patterns: a list of numbers, several direct arguments, default values for empty input, <code>key<\/code> functions, dictionaries, and custom records.<\/p>\n<p>The main design choice is what &#8220;smallest&#8221; means for your data. Sometimes it is the lowest number. Sometimes it is the shortest string, the cheapest product, the earliest timestamp, or the object with the lowest score. The <code>key<\/code> argument is how you make that rule explicit.<\/p>\n<p>Keep the comparison rule simple and deterministic. If two items compare equally, Python returns the first one it sees, so input order can decide ties.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 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\" style=\"cursor:inherit\">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\/#Find_The_Smallest_Number\" >Find The Smallest Number<\/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\/#Compare_Several_Arguments\" >Compare Several Arguments<\/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\/#Use_default_For_Empty_Input\" >Use default For Empty Input<\/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\/#Use_key_For_Custom_Ordering\" >Use key For Custom Ordering<\/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\/#Find_A_Dictionary_Key_With_The_Lowest_Value\" >Find A Dictionary Key With The Lowest Value<\/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\/#Find_A_Custom_Record\" >Find A Custom Record<\/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\/#Common_min_Mistakes\" >Common min Mistakes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Compare_An_Iterable_Or_Arguments\" >Compare An Iterable Or Arguments<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Use_key_For_Records\" >Use key For Records<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Handle_Empty_Input_And_Ties\" >Handle Empty Input And Ties<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/python-min\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/python-min\/#How_do_I_find_the_smallest_value_in_Python\" >How do I find the smallest value in Python?<\/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\/#How_do_I_find_the_smallest_object_by_a_field\" >How do I find the smallest object by a field?<\/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\/#How_do_I_avoid_min_raising_on_an_empty_iterable\" >How do I avoid min raising on an empty iterable?<\/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\/#What_happens_when_values_tie\" >What happens when values tie?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Find_The_Smallest_Number\"><\/span>Find The Smallest Number<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Pass a list or another iterable to <code>min()<\/code>.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">numbers = [8, 3, 12, 5]\n\nsmallest = min(numbers)\n\nprint(smallest)\n<\/code><\/pre>\n<\/div>\n<p>This prints <code>3<\/code>.<\/p>\n<p>The items must be comparable with each other. A list of numbers works because Python knows how to order them.<\/p>\n<p>If the list may be empty, decide whether that is an error or a normal case before calling <code>min()<\/code>. Empty input without a default raises <code>ValueError<\/code>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Compare_Several_Arguments\"><\/span>Compare Several Arguments<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>min()<\/code> can also compare separate arguments.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">smallest = min(14, 9, 27, 3)\n\nprint(smallest)\n<\/code><\/pre>\n<\/div>\n<p>This form is concise when the values are already separate and you do not need to build a list first.<\/p>\n<p>Use the iterable form when the number of items changes at runtime. Use direct arguments when the values are known in the code.<\/p>\n<p>Both forms return one value. The difference is only how the candidates are supplied to the function.<\/p>\n<p><!-- Python Pool visual layout repair 2026-07-13 --><\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/min-function-values-b201.png\" alt=\"Python Pool infographic showing values, min, comparisons, and smallest result\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>min returns the smallest item according to comparison or a key function.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Use_default_For_Empty_Input\"><\/span>Use default For Empty Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>min([])<\/code> raises <code>ValueError<\/code>. Use <code>default<\/code> when empty input is allowed.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">numbers = []\n\nsmallest = min(numbers, default=None)\n\nprint(smallest)\n<\/code><\/pre>\n<\/div>\n<p>The default is returned only when the iterable is empty.<\/p>\n<p>Choose a default that the caller can handle clearly. <code>None<\/code> is common when &#8220;no minimum exists&#8221; is a valid result.<\/p>\n<p>Do not choose a default that could be confused with real data. For example, <code>0<\/code> is a poor default if zero might also be a valid minimum.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Use_key_For_Custom_Ordering\"><\/span>Use key For Custom Ordering<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>key<\/code> argument tells <code>min()<\/code> how to compare items.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">words = [\"python\", \"go\", \"rust\", \"java\"]\n\nshortest = min(words, key=len)\n\nprint(shortest)\n<\/code><\/pre>\n<\/div>\n<p>This returns the shortest word because <code>len<\/code> is used for comparison.<\/p>\n<p>The original item is returned, not the key value. Here, <code>\"go\"<\/code> is returned, not <code>2<\/code>.<\/p>\n<p>This makes <code>key<\/code> useful for selecting a whole record while comparing only one field or derived property.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/min-function-key-b201.png\" alt=\"Python Pool infographic mapping records through min key to the record with smallest property\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>A key function compares a derived property while returning the original record.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Find_A_Dictionary_Key_With_The_Lowest_Value\"><\/span>Find A Dictionary Key With The Lowest Value<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Use <code>key=dictionary.get<\/code> to compare dictionary values while returning the matching key.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">scores = {\n    \"Ava\": 91,\n    \"Noah\": 78,\n    \"Mia\": 84,\n}\n\nlowest_name = min(scores, key=scores.get)\n\nprint(lowest_name)\nprint(scores[lowest_name])\n<\/code><\/pre>\n<\/div>\n<p>Iterating over a dictionary gives its keys, and <code>scores.get<\/code> supplies the comparison value for each key.<\/p>\n<p>This pattern is useful for finding the lowest score, cheapest option, earliest timestamp, or smallest count stored in a mapping.<\/p>\n<p>If you need the value as well, read it with the returned key as shown in the example. That avoids scanning the dictionary twice.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Find_A_Custom_Record\"><\/span>Find A Custom Record<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A <code>key<\/code> function can compare objects or dictionaries by one field.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">products = [\n    {\"name\": \"basic\", \"price\": 12},\n    {\"name\": \"pro\", \"price\": 29},\n    {\"name\": \"trial\", \"price\": 0},\n]\n\ncheapest = min(products, key=lambda item: item[\"price\"])\n\nprint(cheapest)\n<\/code><\/pre>\n<\/div>\n<p>This returns the entire dictionary for the cheapest product.<\/p>\n<p>Use a named helper function instead of a lambda when the comparison rule is complex or reused in several places.<\/p>\n<p>For custom classes, the same approach works with attribute access. You can pass a small helper that returns an object&#8217;s price, size, priority, or timestamp.<\/p>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/min-function-default-b201.png\" alt=\"Python Pool infographic comparing min empty input, default value, and ValueError\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Use default when an empty iterable should return a defined fallback.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Common_min_Mistakes\"><\/span>Common min Mistakes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Do not mix unrelated types in one call unless Python can compare them. For example, numbers and strings are not ordered against each other in modern Python.<\/p>\n<p>Also remember that <code>min()<\/code> returns the first item with the smallest comparison value when there is a tie. If ties need special handling, sort with a compound key or write explicit tie logic.<\/p>\n<p>For large numeric arrays, a vectorized library can be faster and more convenient. For normal Python lists, dictionaries, and records, the built-in function is usually the clearest choice.<\/p>\n<p>In short, use <code>min(items)<\/code> for the smallest comparable item, <code>default<\/code> for allowed empty input, and <code>key<\/code> when the smallest item should be chosen by a derived value.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Compare_An_Iterable_Or_Arguments\"><\/span>Compare An Iterable Or Arguments<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The iterable form consumes one iterable, while the multiple-argument form compares the arguments directly. Do not pass a list as several arguments accidentally; use min(values) when the list itself is the input.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">values = [8, 3, 5]\n\nprint(min(values))\nprint(min(8, 3, 5))<\/code><\/pre>\n<\/div>\n<figure class=\"pythonpool-article-visual pythonpool-supporting-visual\"><img src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/min-function-check-b201.png\" alt=\"Python Pool infographic testing ties, types, key errors, empty input, and validation\" width=\"1536\" height=\"1054\" loading=\"lazy\" decoding=\"async\"><figcaption>Check ties, comparable types, key behavior, empty input, and fallback semantics.<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Use_key_For_Records\"><\/span>Use key For Records<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>key receives each candidate and returns the comparison value, but min returns the original candidate. This is useful for the smallest score, shortest string, earliest timestamp, or lowest-cost record.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">records = [\n    {\"name\": \"slow\", \"seconds\": 4.2},\n    {\"name\": \"fast\", \"seconds\": 1.8},\n]\n\nfastest = min(records, key=lambda record: record[\"seconds\"])\nprint(fastest)<\/code><\/pre>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Handle_Empty_Input_And_Ties\"><\/span>Handle Empty Input And Ties<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>min raises ValueError for an empty iterable unless default is supplied. When values tie, the first item in iteration order wins, so stable order can be part of the function&#8217;s behavior. Use a separate filter or tie-breaking key when needed.<\/p>\n<div class=\"pythonpool-code-scroll\" style=\"max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;\">\n<pre><code class=\"language-python\">values = []\nprint(min(values, default=None))\n\nrecords = [(\"A\", 2), (\"B\", 2)]\nprint(min(records, key=lambda item: item[1]))<\/code><\/pre>\n<\/div>\n<p>Python&#8217;s <a href=\"https:\/\/docs.python.org\/3\/library\/functions.html#min\">min()<\/a> reference documents iterable and argument forms, key comparison, default, and tie behavior.<\/p>\n<p>For related comparison helpers, compare <a href=\"https:\/\/www.pythonpool.com\/python-max-function\/\">max()<\/a>, <a href=\"https:\/\/www.pythonpool.com\/numpy-amin\/\">NumPy amin()<\/a>, and <a href=\"https:\/\/www.pythonpool.com\/numpy-argmin\/\">argmin()<\/a> when the smallest value or its position is the real requirement.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span>Frequently Asked Questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"How_do_I_find_the_smallest_value_in_Python\"><\/span>How do I find the smallest value in Python?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Call min(iterable) or min(value1, value2, &#8230;) when the values are directly available.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_do_I_find_the_smallest_object_by_a_field\"><\/span>How do I find the smallest object by a field?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Pass key= to compute a comparison value while returning the original object.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_do_I_avoid_min_raising_on_an_empty_iterable\"><\/span>How do I avoid min raising on an empty iterable?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Pass default= when an empty input is valid and a fallback value is meaningful.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_happens_when_values_tie\"><\/span>What happens when values tie?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>min returns the first minimum encountered in the input order, so preserve or document order when tie-breaking matters.<\/p>\n<p><script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"How do I find the smallest value in Python?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Call min(iterable) or min(value1, value2, ...) when the values are directly available.\"}},{\"@type\":\"Question\",\"name\":\"How do I find the smallest object by a field?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Pass key= to compute a comparison value while returning the original object.\"}},{\"@type\":\"Question\",\"name\":\"How do I avoid min raising on an empty iterable?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Pass default= when an empty input is valid and a fallback value is meaningful.\"}},{\"@type\":\"Question\",\"name\":\"What happens when values tie?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"min returns the first minimum encountered in the input order, so preserve or document order when tie-breaking matters.\"}}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use Python min() with iterables, multiple arguments, key functions, default values, and empty-input handling.<\/p>\n","protected":false},"author":17,"featured_media":33908,"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],"class_list":["post-9998","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-min-function-python","tag-min-python-2","tag-min-python","tag-python-min-function","tag-python-min-key","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v28.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python min(): Find the Smallest Value Safely<\/title>\n<meta name=\"description\" content=\"Use Python min() with iterables, key functions, default values, and safe handling for empty input in practical examples.\" \/>\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=\"Python min(): Find the Smallest Value Safely\" \/>\n<meta property=\"og:description\" content=\"Use Python min() with iterables, multiple arguments, key functions, default values, and empty-input handling.\" \/>\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=\"2026-07-13T07:02:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-min-1.png\" \/>\n<meta name=\"author\" content=\"Siddharth Jain\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Python Pool\" \/>\n<meta name=\"twitter:description\" content=\"Practical Python tutorials, error fixes, code examples, and project guides.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-min-1.png\" \/>\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=\"6 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\":\"Python min(): Find the Smallest Value Safely\",\"datePublished\":\"2021-03-13T14:58:00+00:00\",\"dateModified\":\"2026-07-13T07:02:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/python-min\\\/\"},\"wordCount\":1024,\"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\\\/2026\\\/07\\\/python-min-function-guide-pythonpool.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\":\"Python min(): Find the Smallest Value Safely\",\"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\\\/2026\\\/07\\\/python-min-function-guide-pythonpool.png\",\"datePublished\":\"2021-03-13T14:58:00+00:00\",\"dateModified\":\"2026-07-13T07:02:41+00:00\",\"description\":\"Use Python min() with iterables, key functions, default values, and safe handling for empty input in practical examples.\",\"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\\\/2026\\\/07\\\/python-min-function-guide-pythonpool.png\",\"contentUrl\":\"https:\\\/\\\/www.pythonpool.com\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/python-min-function-guide-pythonpool.png\",\"width\":1350,\"height\":650,\"caption\":\"Python min function guide\"},{\"@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\":\"Python min(): Find the Smallest Value Safely\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pythonpool.com\\\/\",\"name\":\"Python Pool\",\"description\":\"Practical Python tutorials, error fixes, code examples, and project guides.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonpool.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pythonpool.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"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:\\\/\\\/x.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:\\\/\\\/secure.gravatar.com\\\/avatar\\\/152b0ac2e5fa2e6328f374499fff4a7a6299477b9cf7bbb15ebc01a88f8f673f?s=96&d=wavatar&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/152b0ac2e5fa2e6328f374499fff4a7a6299477b9cf7bbb15ebc01a88f8f673f?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/152b0ac2e5fa2e6328f374499fff4a7a6299477b9cf7bbb15ebc01a88f8f673f?s=96&d=wavatar&r=g\",\"caption\":\"Siddharth Jain\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python min(): Find the Smallest Value Safely","description":"Use Python min() with iterables, key functions, default values, and safe handling for empty input in practical examples.","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:\/\/www.pythonpool.com\/python-min\/","og_locale":"en_US","og_type":"article","og_title":"Python min(): Find the Smallest Value Safely","og_description":"Use Python min() with iterables, multiple arguments, key functions, default values, and empty-input handling.","og_url":"https:\/\/www.pythonpool.com\/python-min\/","og_site_name":"Python Pool","article_published_time":"2021-03-13T14:58:00+00:00","article_modified_time":"2026-07-13T07:02:41+00:00","og_image":[{"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-min-1.png","type":"","width":"","height":""}],"author":"Siddharth Jain","twitter_card":"summary_large_image","twitter_title":"Python Pool","twitter_description":"Practical Python tutorials, error fixes, code examples, and project guides.","twitter_image":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-min-1.png","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Siddharth Jain","Est. reading time":"6 minutes"},"schema":{"@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":"Python min(): Find the Smallest Value Safely","datePublished":"2021-03-13T14:58:00+00:00","dateModified":"2026-07-13T07:02:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/python-min\/"},"wordCount":1024,"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\/2026\/07\/python-min-function-guide-pythonpool.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":"Python min(): Find the Smallest Value Safely","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\/2026\/07\/python-min-function-guide-pythonpool.png","datePublished":"2021-03-13T14:58:00+00:00","dateModified":"2026-07-13T07:02:41+00:00","description":"Use Python min() with iterables, key functions, default values, and safe handling for empty input in practical examples.","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\/2026\/07\/python-min-function-guide-pythonpool.png","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2026\/07\/python-min-function-guide-pythonpool.png","width":1350,"height":650,"caption":"Python min function guide"},{"@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":"Python min(): Find the Smallest Value Safely"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Practical Python tutorials, error fixes, code examples, and project guides.","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"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:\/\/x.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:\/\/secure.gravatar.com\/avatar\/152b0ac2e5fa2e6328f374499fff4a7a6299477b9cf7bbb15ebc01a88f8f673f?s=96&d=wavatar&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/152b0ac2e5fa2e6328f374499fff4a7a6299477b9cf7bbb15ebc01a88f8f673f?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/152b0ac2e5fa2e6328f374499fff4a7a6299477b9cf7bbb15ebc01a88f8f673f?s=96&d=wavatar&r=g","caption":"Siddharth Jain"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=9998"}],"version-history":[{"count":23,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9998\/revisions"}],"predecessor-version":[{"id":41602,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/9998\/revisions\/41602"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/33908"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=9998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=9998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=9998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}