标签:pre 交换 lse 登陆 temp print 用户名 user input
结果输出 1 2 3 4 5 6 8 9
count = 1 while count < 10: count = count + 1 if count == 7: print(‘‘) else: print(count)
输出0-100内的偶数
n = 1 while n < 101: temp = n % 2 求余 if temp == 0: 余数为0输出结果 print(n) else: 否则pass
pass
n = n + 1
求1-2+3-4+5-6----99
n = 1 s = 0 while n < 100: temp = n % 2 把余数赋值给temp if temp == 0: s = s - n else: s = s + n n = n + 1 print(s)
三次登陆验证
count = 0 while count < 3: user = input(‘>>>‘) 用户交换 pwd = input(‘>>>‘) if user == ‘alex‘ and pwd == ‘123‘: 条件语句 print("欢迎登陆") print("......") break else: print("用户名或者密码错误") count = count + 1
标签:pre 交换 lse 登陆 temp print 用户名 user input
原文地址:https://www.cnblogs.com/yezia/p/10034442.html