用python求一个数组的和与平均值的实现方法
作者:Emily188 时间:2021-01-10 20:11:24
如下所示:
# coding = GBK
a =[1,2,3,4,5]
sum=0
b = len(a)
print("这个数组的长度为:",b)
for i in a:
sum =sum +i
print("这个数组之和为:",sum)
print("这个数组平均数为",sum/b)
来源:https://blog.csdn.net/Emily0308/article/details/80079636
标签:python,数组,平均值
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
华为2019校招笔试题之处理字符串(python版)
2023-09-29 19:42:04
Python实现批量下载图片的方法
2022-11-17 07:20:08
Python爬虫之网页图片抓取的方法
2021-12-19 00:47:20
![](https://img.aspxhome.com/file/2023/3/78523_0s.png)
如何在Python中引用其他模块
2022-09-26 23:30:21
![](https://img.aspxhome.com/file/2023/2/69492_0s.png)
Python制作动态词频条形图的全过程
2021-04-25 11:14:52
![](https://img.aspxhome.com/file/2023/2/96462_0s.png)
使用python matplotlib 画图导入到word中如何保证分辨率
2023-06-30 21:07:31
![](https://img.aspxhome.com/file/2023/3/97293_0s.jpg)
判断触发器正在处理的是插入,删除还是更新触发
2012-01-29 18:30:34
基于Python实现五子棋游戏
2023-01-29 21:47:42
![](https://img.aspxhome.com/file/2023/1/65911_0s.jpg)
Python多进程机制实例详解
2021-04-10 00:16:44
最新google pr查询接口
2012-03-12 20:00:39
Asp下Access无法更新的解决方法
2012-12-04 20:19:35
Python 实现王者荣耀中的敏感词过滤示例
2023-08-14 01:21:04
使用python检测手机QQ在线状态的脚本代码
2023-03-27 02:12:06
教你安装python Django(图文)
2023-11-13 14:22:39
![](https://img.aspxhome.com/file/2023/0/63890_0s.png)
使用Pandas将inf, nan转化成特定的值
2023-04-15 23:36:33
![](https://img.aspxhome.com/file/2023/4/86354_0s.jpg)
用Python编写一个漏洞验证脚本
2022-03-23 02:30:43
![](https://img.aspxhome.com/file/2023/5/79775_0s.jpg)
Python 2/3下处理cjk编码的zip文件的方法
2022-08-05 17:53:40
python连接kafka加载数据的项目实践
2021-04-23 07:14:38
![](https://img.aspxhome.com/file/2023/2/89382_0s.png)
Python用SSH连接到网络设备
2022-01-20 08:57:41
![](https://img.aspxhome.com/file/2023/1/89191_0s.png)
配置SQL Server以允许远程连接
2010-03-08 13:12:00