statistics模块的作用

statistics模块实现了很多常用的统计公式,允许使用Python的各种数值类型(int,float,Decimal和Fraction)来完成高效的计算。

 1、求一个列表的平均数

from statistics import *

data = [1, 2, 2, 5, 10, 12]
print('{:0.2f}'.format(mean(data)))
statistics_mean.py

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2021-12-06
  • 2021-06-25
  • 2021-06-09
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案