ITPub博客

首页 > 应用开发 > Python > Python中如何求列表list的平均数

Python中如何求列表list的平均数

Python 作者:jiunile 时间:2020-12-01 20:18:24 0 删除 编辑

Python中如何求列表list的平均数

当列表list中只包含数字时,如何求取它的平均数:

from numpy import *
a = [52,69,35,65,89,15,34]
b = mean(a)
print(b)1234

运行结果:

51.285714285714285


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69979345/viewspace-2738620/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-07-17

  • 博文量
    16
  • 访问量
    13549