实现简单的用户表单验证登录
user="desperado" pwd="123456" s=0 for i in range(10): if s < 3: username = input("用户名:") password = input("密码:") if username == user and password == pwd: print("welcome,login successful") break else: print("username or password input error") else: con=input("rester input:") if con == ‘y‘: s=0 continue else: print("input error,exit...") break s += 1
说明:循环10次,输入错误3次进行提示是否继续
时间: 2024-10-23 14:04:19