min() Minimum value

Last updated: 2026-09-22

min() Minimum value

min() works like max() but returns the smallest item.

CategoryBuilt-in Functions
KindBuilt-in Function
Python Versionall

📝 Syntax

min(iterable, *[, key, default])
min(arg1, arg2, *args[, key])

⚙️ Parameters

iterable RequiredAn iterable, or the first compared value in the multi-arg form.
args OptionalAdditional values to compare (variadic).
key OptionalA one-arg function used to derive the comparison key.(Default:None)
default OptionalValue returned when the iterable is empty.(Default:None)

Returns:The smallest item, or default when the iterable is empty.

💥 Raises

▶ Example

Edit the code, press Run, and see the result in the output panel:

Output:

1
e
More case studies coming soon — check back later.

❓ FAQ

QWhat happens with min([])?
AIt raises a ValueError because an empty sequence has no minimum; pass the default= parameter to get a fallback, e.g. min([], default='empty').
QWhat does min('hello') return?
AIt returns 'e' — strings are compared character by character, and 'e' has the smallest Unicode codepoint among 'hello'.
QAre min() and max() perfectly symmetric in usage?
AYes — the argument forms, key, and default all work identically; the only difference is the direction of comparison.
QHow do I find the element closest to some value?
AUse key with abs: min(lst, key=lambda x: abs(x - target)) — it compares the distance rather than the elements themselves.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏