目录
给定一组实验结果,如何快速计算其平均值和标准差
import statistics
# 将数据存放在一个列表中
data_list = [18.72, 19.64, 19.27]
# 计算平均值
mean_value = statistics.mean(data_list)
mean_value = round(mean_value, 2) # 保留两位小数
print("平均值:", mean_value)
# 计算标准差
std_deviation = statistics.stdev(data_list)
std_deviation = round(std_deviation,2)
print("标准差:", std_deviation)