原题是:计算s=1+2加3……直到s大于1000为止,不知道什么原因,我这运行不出来

img

你要不试试把while后面的分号去掉?


s = 0
i = 1
while(s <= 1000):
  s = s + i
  i = i + 1

print(f's={s}')

img