当前位置:首页 > python教程 > python进阶

Python3 List min()方法

python3 list min()方法

python3 列表

描述

min() 方法返回列表元素中的最小值。

语法

min()方法语法:

min(list)

参数

  • list -- 要返回最小值的列表。

返回值

返回列表元素中的最小值。

实例

以下实例展示了 min()函数的使用方法:

#!/usr/bin/python3

list1, list2 = ['google', '51frw', 'taobao'], [456, 700, 200]

print ("list1 最小元素值 : ", min(list1))
print ("list2 最小元素值 : ", min(list2))

以上实例输出结果如下:

list1 最小元素值 :  google
list2 最小元素值 :  200


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!