python学习之路day1
开始学习python,旨在提升自己吧!!加油
DAY 1作业
需求:用户登录程序 4次登陆尝试后禁止 同一用户名3次会被封
__author__ = 'Nullier' information_user = {"mike":1234,"lele":1234}#导入用户信息库 blacklist_username = []#导入很名单列表 username_try_list = [] #声明用户尝试列表 count = 0 while count < 4: _username = input("username:") _password = int(input("pasword:")) username_try_list.append(_username) if _username in blacklist_username: print("用户名被锁,禁止登陆") break elif _username in information_user and information_user[_username] == _password: print("欢迎进入") else: print("账户或密码错误") count +=1 if count == 4: print("尝试次数过多,禁止登陆") if username_try_list.count(_username) == 3: blacklist_username.append(_username) #存在3次以上的用户名会被加入黑名单 continue

浙公网安备 33010602011771号