此函數返回列表中兩個或多個數字的平均值。
def average(*args): return sum(args, 0.0) / len(args) average(5, 8, 2) # 5.0
相關文章:
最新文章
最受歡迎文章