#输出1,2,3,4,5,6,8,9,10
a = 1 while a<11: if a==7: pass else: print(a) a = a+1
#计算1到100连加并输出 b = 1 sum = 0 while b<101: sum = sum + b b = b+1 print(sum)
#输出1-100的奇数 c = 1 while c<101: d = c % 2 if d == 1: print(c) c = c+1 #输出1-100的偶数 c = 1 while c<101: d = c % 2 if d == 0: print(c) c = c+1
#计算1-2+3-4....+99并输出 a = 1 sum = 0 while a<100: c = a%2 if c == 1: sum = sum + a else: sum = sum - a a = a+1 print(sum)
#用户登陆(三次机会重试) i = 1 while i<4: id = input("请输入用户名:") if id == "root": print("ok") break else: j = 3-i print("您还可以输入",j,"次") i = i+1 print("done")