标签:登陆 练习 测试 python练习题 tin lse http 用户登录 用户名
1 number = 0 2 while number<10: 3 number +=1 4 if number == 7: 5 continue 6 print(number)
1 count = 1 2 sum = 0 3 flag =True 4 while flag: 5 sum = sum + count 6 count += 1 7 if count > 100: 8 break 9 print(‘1-100的总和是:‘,sum)
1 odd = 1 2 while odd <=100: 3 print(odd) 4 odd += 2
1 even = 0 2 while even <=100: 3 even += 2 4 if even > 100: 5 continue 6 print(even)
1 odd = 1 2 even = 2 3 odd_sum = 0 4 even_sum = 0 5 while odd < 100: 6 odd_sum = odd_sum + odd 7 odd += 2 8 while even < 100: 9 even_sum = even_sum + even 10 even += 2 11 print(‘odd_sum:‘,odd_sum,‘even_sum:‘,even_sum) 12 count_sum = odd_sum - even_sum 13 print("1-2+3-4+5...99的所有数的和是:",count_sum)
count_number = 3 name = ‘admin‘ password = ‘admin‘ flag = True while flag: user_name = input("请输入你的用户名:") user_password = input("请输入你的登录密码:") if user_name==name and user_password==password: print(‘用户名与登录密码输入正确,用户登录成功‘) break if count_number == 3: print(‘用户名或登录密码输入不一致,你还有两次机会‘) elif count_number == 2: print(‘用户名或登录密码输入不一致,你还有一次机会‘) else: print(‘用户名或登录密码输入不一致,你的机会已经用完,请过5分钟后再试‘) count_number -= 1 if count_number < 1: break
标签:登陆 练习 测试 python练习题 tin lse http 用户登录 用户名
原文地址:https://www.cnblogs.com/Wolf-Dreams/p/9693332.html