"""
作者:白
日期:2018年1月17日
功能:使用while 循环实现2-3+4-5+6.....+100的值
"""
i=2
list = [i]
while i < 100:
i += 1
if i % 2 ==0:
list.append(i)
elif i %2 != 0:
list.append(-i)
print(list)
print(sum(list))
转载于:https://blog.51cto.com/laobaiv1/2061617