Python min() 函数

Python 教程 · 2019-02-01 22:14:20

描述

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

语法

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

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

参数

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

返回值

返回给定参数的最小值。

实例

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

#!/usr/bin/python

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 教程 文章: https://codercto.com/courses/l/8.html

查看所有标签

The Smashing Book

The Smashing Book

Jacob Gube、Dmitry Fadeev、Chris Spooner、Darius A Monsef IV、Alessandro Cattaneo、Steven Snell、David Leggett、Andrew Maier、Kayla Knight、Yves Peters、René Schmidt、Smashing Magazine editorial team、Vitaly Friedman、Sven Lennartz / 2009 / $ 29.90 / € 23.90

The Smashing Book is a printed book about best practices in modern Web design. The book shares technical tips and best practices on coding, usability and optimization and explores how to create succes......一起来看看 《The Smashing Book》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具