Python 3 教程
max() 方法返回給定參數(shù)的最大值,參數(shù)可以為序列。
以下是 max() 方法的語法:
max( x, y, z, .... )
以下展示了使用 max() 方法的實(shí)例:
#!/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))
以上實(shí)例運(yùn)行后輸出結(jié)果為:
max(80, 100, 1000) : 1000 max(-20, 100, 400) : 400 max(-80, -20, -10) : -10 max(0, 100, -400) : 100其他擴(kuò)展