Python 3 内置函数 - min()
函数
0. min()
函数
返回最小值,参数可以为序列。
1. 使用方法
>>> help(min)
Help on built-in function min in module builtins:
min(...)
## 使用方法:
min(iterable, *[, default=obj, key=func]) -> value
min(arg1, arg2, *args, *[, key=func]) -> value
With a single iterable argument, return its smallest item. The
default keyword-only argument specifies an object to return if
the provided iterable is empty.
With two or more arguments, return the smallest argument.
2. 使用示例
示例1.
>>> min([1,2,3,0])
# output:
0
示例2.
>>> list(range(5)), min(range(3))
# output:
([0, 1, 2, 3, 4], 0)