描述
這個max()方法返回具有最大值的元組中的元素。
用法
以下是語法max()方法 -
max(tuple)
參數
tuple- 這是一個元組,從中返回最大值元素。
返回值
此方法返回具有最大值的元組中的元素。
示例
下麵的例子展示了 max() 方法的用法。
#!/usr/bin/python3
tuple1, tuple2 = ('maths', 'che', 'phy', 'bio'), (456, 700, 200)
print ("Max value element:", max(tuple1))
print ("Max value element:", max(tuple2))
結果
當我們運行上麵的程序時,它會產生以下結果 -
Max value element: phy Max value element: 700
相關用法
- Python 3 Tuple min()用法及代碼示例
- Python 3 Tuple tuple()用法及代碼示例
- Python 3 Tuple len()用法及代碼示例
- Python 3 Tuple cmp()用法及代碼示例
- Python 3 Tkinter pack()用法及代碼示例
- Python 3 Tkinter place()用法及代碼示例
- Python 3 Number tan()用法及代碼示例
- Python 3 os.fstatvfs()用法及代碼示例
- Python 3 List pop()用法及代碼示例
- Python 3 os.minor()用法及代碼示例
- Python 3 dictionary cmp()用法及代碼示例
- Python 3 String isupper()用法及代碼示例
- Python 3 os.close()用法及代碼示例
- Python 3 List index()用法及代碼示例
- Python 3 String decode()用法及代碼示例
- Python 3 os.unlink()用法及代碼示例
- Python 3 os.major()用法及代碼示例
- Python 3 Number atan()用法及代碼示例
- Python 3 List len()用法及代碼示例
- Python 3 String maketrans()用法及代碼示例
注:本文由純淨天空篩選整理自 Python 3 - Tuple max() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。