如何用python计算1到100的和?
python计算1到100的和的代码如下:
sum = 0 for i in range(1,101): sum = sum + i print(sum)
输出结果:5050