1 start =1 2 sum =0 3 while start <100: 4 if start % 2 ==0: 5 sum =sum -start 6 else: 7 sum =sum + start 8 start =start+1 9 print(sum)
python入门:求1-2+3-4+5...99的所有数的和
原文:https://www.cnblogs.com/yspass/p/8982891.html