在python中实现对list求和及求积
作者:强哥之神 时间:2022-05-28 15:02:16
如下所示:
# the basic way
s = 0
for x in range(10):
s += x
# the right way
s = sum(range(10))
# the basic way
s = 1
for x in range(1, 10):
s *= x
# the other way
from operator import mul
reduce(mul, range(1, 10))
来源:https://blog.csdn.net/qianggezhishen/article/details/46532441
标签:python,list,求和,求积
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
高性能表现的网站(译)
2008-08-31 20:26:00
![](https://img.aspxhome.com/file/UploadPic/20088/31/2008831203229237s.gif)
Python实现读取字符串按列分配后按行输出示例
2023-08-07 19:39:14
数字人组件反写[asp组件开发实例1]
2009-06-09 13:10:00
![](https://img.aspxhome.com/file/UploadPic/20096/9/vb-34s.gif)
selenium python浏览器多窗口处理代码示例
2023-11-20 07:09:29
Python使用Beautiful Soup爬取豆瓣音乐排行榜过程解析
2023-10-13 08:08:24
![](https://img.aspxhome.com/file/2023/3/69523_0s.png)
python try...finally...的实现方法
2022-09-27 06:34:35
基于JS判断iframe是否加载成功的方法(多种浏览器)
2023-08-24 04:14:52
XPath 1.0 学习笔记
2009-02-25 12:19:00
JS实现仿新浪微博发布内容为空时提示功能代码
2023-08-22 21:52:13
![](https://img.aspxhome.com/file/2023/4/56164_0s.jpg)
python使用多进程的实例详解
2021-09-03 19:19:44
python批量修改交换机密码的示例
2023-06-29 07:52:42
通过启动脚本来感受ASP的力量
2008-11-07 15:25:00
python中使用asyncio实现异步IO实例分析
2021-02-06 10:02:50
ASP:一个网站空间多个域名访问
2008-11-21 17:03:00
python操作链表的示例代码
2023-08-08 23:55:41
python opencv把一张图片嵌入(叠加)到另一张图片上的实现代码
2021-08-11 12:52:30
![](https://img.aspxhome.com/file/2023/9/90399_0s.jpg)
Python对FTP交互封装的实现
2023-05-18 15:12:14
从零开始学Golang的接口
2023-10-09 02:26:03
Oracle数据库密码文件的使用与维护
2010-07-28 13:27:00
MySQL修改配置,区分大小写
2010-12-03 16:31:00