当前位置:网站首页>实例045:求和
实例045:求和
2022-08-10 02:01:00 【懒笑翻】
题目:统计 1 到 100 之和。
程序分析:无
一、代码
# 方法一
res = 0
for i in range(1, 101):
res += i
print(res)
# 方法二
print(sum(range(1, 101)))二、结果

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓懒笑翻诚邀您点击下方一起来学习讨论↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
边栏推荐
- 【QT】QT项目:自制Wireshark
- 781. 森林中的兔子
- 2022.8.9考试独特的投标拍卖--800题解
- Redis - Basic operations and usage scenarios of String|Hash|List|Set|Zset data types
- 2022.8.8 exam sweeps the horse (sweeper) antithesis
- 牛客刷题——剑指offer(第四期)
- Under pressure, there must be cowards
- How Microbes Affect Physical Health
- Go语言JSON文件的读写操作
- 【二叉树-简单】112. 路径总和
猜你喜欢
随机推荐
数组(一)
[Kali Security Penetration Testing Practice Course] Chapter 9 Wireless Network Penetration
《GB39707-2020》PDF download
2022.8.8考试从记忆中写入(memory)题解
[Kali Security Penetration Testing Practice Tutorial] Chapter 6 Password Attack
翻译工具-翻译工具下载批量自动一键翻译免费
数据库治理利器:动态读写分离
LeetCode 每日一题——1413. 逐步求和得到正数的最小值
中级xss绕过【xss Game】
OpenCV图像处理学习二,图像掩膜处理
2022.8.8考试游记总结
GDB之指令基础参数
Write a drop-down refresh component
xss的DOMPurify过滤框架:一个循环问题以及两个循环问题
基于误差状态的卡尔曼滤波ESKF
数据挖掘和数据仓库之间的区别
免费文档翻译软件电脑版软件
idea 删除文件空行
【Kali安全渗透测试实践教程】第7章 权限提升
P1564 Worship









