Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- sign_up_in = input('请输入「注册」或「登录」:')
- if sign_up_in == '注册':
- username = input('请出入用户名:')
- password = input('请出入密码:')
- users.append({
- 'username': username,
- 'password': password
- })
- print('注册成功')
- elif sign_up_in == '登录':
- username = input('请出入用户名:')
- password = input('请出入密码:')
- if username in err and err[username] >= 3:
- print('失败过多,ban掉:' + username)
- return
- for user in users:
- if username == user['username'] and password == user['password']:
- print('登录成功:' + username)
- else:
- if username in err:
- err[username] += 1
- else:
- err[username] = 1
- print('登录失败:' + username + ' ' + str(err[username]) + '次')
- else:
- print('error,必须是 注册 或 密码')
- if __name__ == '__main__':
- users = []
- err = {}
- while 1:
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement