Python3 min() 函数

Python 3 教程 · 2019-02-05 13:59:03

描述

min() 方法返回给定参数的最小值,参数可以为序列。

语法

以下是 min() 方法的语法:

min( x, y, z, .... )

参数

  • x -- 数值表达式。
  • y -- 数值表达式。
  • z -- 数值表达式。

返回值

返回给定参数的最小值。

实例

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

#!/usr/bin/python3

print ("min(80, 100, 1000) : ", min(80, 100, 1000))
print ("min(-20, 100, 400) : ", min(-20, 100, 400))
print ("min(-80, -20, -10) : ", min(-80, -20, -10))
print ("min(0, 100, -400) : ", min(0, 100, -400))

以上实例运行后输出结果为:

min(80, 100, 1000) :  80
min(-20, 100, 400) :  -20
min(-80, -20, -10) :  -80
min(0, 100, -400) :  -400

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

How to Design Programs

How to Design Programs

Matthias Felleisen、Robert Bruce Findler、Matthew Flatt、Shriram Krishnamurthi / The MIT Press / 2001-2-12 / 71.00美元

This introduction to programming places computer science in the core of a liberal arts education. Unlike other introductory books, it focuses on the program design process. This approach fosters a var......一起来看看 《How to Design Programs》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具