标签:logs name hid 提示 put 作业 code display 使用
1 count = 1 2 while count <=10: 3 if count != 7: 4 print(count) 5 count += 1
1 for i in range(1,11): 2 if i != 7: 3 print(i)
1 sum = 0 2 count = 1 3 while count <= 100: 4 sum += count 5 count += 1 6 print(sum)
1 sum = 0 2 for i in range(1,101): 3 sum += i 4 print(sum)
1 count = 1 2 while count <= 100: 3 if count % 2 == 1: 4 print(count) 5 count += 1
1 for i in range(1,101): 2 if i % 2 == 1: 3 print(i)
1 count = 1 2 while count <= 100: 3 if count % 2 == 0: 4 print(count) 5 count += 1
1 for i in range(1,101): 2 if i != 0 and i % 2 == 0: 3 print(i)
1 count = 1 2 sum = 0 3 while count <= 99: 4 if count % 2 == 1: 5 sum += count 6 count += 1 7 else: 8 sum -= count 9 count += 1 10 print(sum)
1 sum = 0 2 for i in range(1,100): 3 if i % 2 == 1: 4 sum += i 5 else: 6 sum -= i 7 print(sum)
1 count = 1 2 name = ‘zzn‘ 3 passwd = 123 4 while count <= 3: 5 username = input(‘请输入用户名:‘) 6 password = input(‘请输入密码:‘) 7 password = int(password) 8 if username == name and password == passwd: 9 print(‘登陆成功!‘) 10 break 11 else: 12 print(‘用户名或密码错误!‘) 13 count += 1
1 count = 1 2 name = ‘zzn‘ 3 passwd = 123 4 while True: 5 username = input(‘请输入用户名:‘) 6 password = input(‘请输入密码:‘) 7 password = int(password) 8 if username == name and password == passwd: 9 print(‘登陆成功!‘) 10 break 11 else: 12 print(‘用户名或密码错误!‘) 13 count += 1 14 if count == 4: 15 print(‘失败次数过多,已锁定!‘) 16 break
1 name = ‘zzn‘ 2 passwd = 123 3 for i in range(1,4): 4 username = input(‘请输入用户名:‘) 5 password = input(‘请输入密码:‘) 6 password = int(password) 7 if username == name and password == passwd: 8 print(‘登陆成功!‘) 9 break 10 else: 11 print(‘用户名或密码错误!‘)
1 name = ‘zzn‘ 2 passwd = 123 3 for i in range(1,4): 4 username = input(‘请输入用户名:‘) 5 password = input(‘请输入密码:‘) 6 password = int(password) 7 if username == name and password == passwd: 8 print(‘登陆成功!‘) 9 break 10 else: 11 print(‘用户名或密码错误!‘) 12 if i == 3: 13 print(‘失败次数过多,已锁定!‘)
标签:logs name hid 提示 put 作业 code display 使用
原文地址:http://www.cnblogs.com/zzn91/p/6985053.html