首页 > 代码库 > 差数和

差数和

 1 #!/usr/bin/env python
 2 # -*- coding: utf-8 -*-
 3 
 4 i = 1
 5 o = 0
 6 while i <= 99:
 7     if i % 2 ==1:
 8         o = o + i
 9     elif i % 2 == 0:
10         o = o - i
11     else:
12         print(玩蛋)
13     #print(i)
14     #qishu = i % 2 == 1
15     #for i in qishu:
16      #   print(i)
17     i += 1
18 print(o)

 

差数和