创建一个python脚本,实现下面功能:
--要求用户输入用户名和密码;
--如果 用户名和密码均正确时,显示“welcome to user manager system“;
-- 如果用户名和密码不正确时,重新输入,最多有三次机会;
--用户输入超过三次机会后,报错“你已经登陆过三次,请10min以后在登陆“。
user = 'root' passwd = 'westos' count = 0 while count < 3: username = raw_input('Username:') password = raw_input('Password:') if username == user and password == passwd: print "welcome to user manage system" else : print "your username or password error" count += 1 print "you have logged in three times,please log in after 10 min" ##############################
name = 'root' passwd = 'westos' count = 0 username = raw_input('用户名:') if name == username: while count < 3: password = raw_input("登陆密码:") if name ==username and password == passwd: print ("欢迎登陆,%s" %name) else: print("帐号和密码不一致") count += 1 print ("对不起,您的密码以连续输入三次,请退出登陆") else: print ("用户密码不存在,请输入正确的用户名")