0
点赞
收藏
分享

微信扫一扫

Python 3 内置函数 - `min()`函数

雷亚荣 2022-03-20 阅读 56
python

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)

举报

相关推荐

0 条评论