📜  python 平均 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:15.351000             🧑  作者: Mango

代码示例6
def cal_average(num):
    sum_num = 0
    for t in num:
        sum_num = sum_num + t           

    avg = sum_num / len(num)
    return avg

print("The average is", cal_average([18,25,3,41,5]))