x1 = 1
d = 3
n = 100
x100 = x1+(n-1)*d;
s = n*(x1+x100)/2;
print s
d = 3
n = 100
x100 = x1+(n-1)*d;
s = n*(x1+x100)/2;
print s
2018-12-10
已采纳回答 / 明月不再
你是在cmd中用python命令吗?你先 cd到你文件夹下,再运行比如:C:\Users\Administrator>cd Desktop\py #我这里进入到我的桌面新建的py文件夹下了再使用 C:\Users\Administrator\Desktop\py>python hello.py #就可以了
2018-12-09
print [int(a + b + c) for a in '123456789' for b in '0123456789' for c in '123456789' if a==c]
2018-12-08
已采纳回答 / qq_慕码人7207365
按照原顺序,sum=1+3+5+...+99。如果改变顺序的话,x会先累加再与sum相加,sum=3+5+7....+101。最后会比原来多一个101,少一个1.
2018-12-08