def calculate_average(numbers):
total = sum(numbers)
average = total / len(numbers)
return average
# 示例输入
number_list = [1, 2, 3, 4, 5]
# 调用函数并打印结果
average_value = calculate_average(number_list)
print("平均值为:", average_value)
标签:平均值,python,average,list,number,列表,numbers,total,calculate From: https://blog.51cto.com/u_16058927/7012283