Python3 max() 函数
Python 3 教程
· 2019-02-05 13:43:21
描述
max() 方法返回给定参数的最大值,参数可以为序列。
语法
以下是 max() 方法的语法:
max( x, y, z, .... )
参数
- x -- 数值表达式。
- y -- 数值表达式。
- z -- 数值表达式。
返回值
返回给定参数的最大值。实例
以下展示了使用 max() 方法的实例:
#!/usr/bin/python3
print ("max(80, 100, 1000) : ", max(80, 100, 1000))
print ("max(-20, 100, 400) : ", max(-20, 100, 400))
print ("max(-80, -20, -10) : ", max(-80, -20, -10))
print ("max(0, 100, -400) : ", max(0, 100, -400))
以上实例运行后输出结果为:
max(80, 100, 1000) : 1000 max(-20, 100, 400) : 400 max(-80, -20, -10) : -10 max(0, 100, -400) : 100
点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html
The Art of Computer Programming, Volume 2
Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99
Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!