用python代码写一个从1+2+3+.......+100的求和
时间: 2023-06-01 21:05:26 浏览: 1562
python1.使用while循环实现输出2-3+4-5+6...+100 的和_一个倔强的女孩的博客-CSDN博客_python1+2+3+4+5+6+…+100代码.pdf
Sure, here's the Python code to sum the numbers from 1 to 100:
sum = 0
for i in range(1, 101):
sum += i
print("The sum of numbers from 1 to 100 is ", sum)
阅读全文