Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. def main():
  2. sign_up_in = input('请输入「注册」或「登录」:')
  3.  
  4. if sign_up_in == '注册':
  5. username = input('请出入用户名:')
  6. password = input('请出入密码:')
  7. users.append({
  8. 'username': username,
  9. 'password': password
  10. })
  11. print('注册成功')
  12. elif sign_up_in == '登录':
  13. username = input('请出入用户名:')
  14. password = input('请出入密码:')
  15.  
  16. if username in err and err[username] >= 3:
  17. print('失败过多,ban掉:' + username)
  18. return
  19. for user in users:
  20. if username == user['username'] and password == user['password']:
  21. print('登录成功:' + username)
  22. else:
  23. if username in err:
  24. err[username] += 1
  25. else:
  26. err[username] = 1
  27. print('登录失败:' + username + ' ' + str(err[username]) + '次')
  28. else:
  29. print('error,必须是 注册 或 密码')
  30.  
  31.  
  32. if __name__ == '__main__':
  33. users = []
  34. err = {}
  35. while 1:
  36. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement