第一种:
i=0
sum=0
a=0
while i<102:
if i>=1 and i%4==1:
sum+=i
elif i%2!=0 and i!=1:
a=a+i
i+=1
print(sum-a)
第二种:
a=1
b=-3
sum1=0
sum2=0
while a<=101and b>=-99:
sum1+=a
sum2+=b
a+=+4
b+=-4
print(sum1+sum2+101)
第三种:
print(sum(range(1,102,4))-sum(range(3,102,4)))
自我反省:
第一种与第二种是我写的 第三种是我朋友写的 当你学习Python取得一点点成绩的时候不要骄傲 永远会有人写的代码比你更漂亮,更完美 虚心学习 谦虚做人