Day2

 

 

 

 

一.输出1,2,3,4,5,6,8,9,10

#!/usr/bin/env python
# -*- coding:utf8 -*-

n = 1
while n < 11 :
if n == 7:
pass
else:
print(n)
n = n + 1
print("end>>>>")

二.输出1到100的和

#!/usr/bin/env python
#-*- coding:utf8 -*-

n=1
s=0
while n < 101 :
s = n + s
n = n + 1
print(s)
print(n)
print(s)

三.输出1到100的奇数

#!/usr/bin/env python
# -*- coding:utf8 -*-

n=1
while n < 101:
temp = n % 2
if temp == 0:
pass
else:
print(n)
n = n + 1
print("end_____fuck")

 

四.输出1到100的偶数

#!/usr/bin/env python
# -*- coding:utf8 -*-

n = 1
while n < 101:
temp = n % 2
if temp == 0:
print(n)
else:
pass
n = n + 1
print("end_____")

五.输出1-2+3-4....-98+99的结果

#!/usr/bin/env python
# -*- coding:utf8 -*-

n = 1
s = 0
while n < 100:
temp = n % 2
if temp == 0:
s = s - n
else:
s = s + n
n = n + 1
print(n)
print(s)
print(s)

 

posted @ 2019-10-16 22:53  AMKOOL  阅读(132)  评论(0编辑  收藏  举报