python中的max()方法返回給定參數的值,參數可以為序列。
以下是max()方法的語法:
max(x,y,z,....)
參數
x--數值表達式。
y--數值表達式。
z--數值表達式。
例如
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里的max函數怎么用,希望對大家有所幫助,如果想要了解更多Python相關知識,請關注IT培訓機構:千鋒教育。