Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. def get_passwd_from_user():
  2. from_user = input('input your password:\n>>')
  3. return from_user
  4.  
  5.  
  6. def is_mixed(passwd):
  7.  
  8. numeric = False
  9. alpha = False
  10. special_char = False
  11.  
  12. for char in passwd:
  13. if char.isalpha():
  14. alpha = True
  15. elif char.isnumeric():
  16. numeric = True
  17. else:
  18. special_char = True
  19.  
  20. return (numeric and alpha) and special_char
  21.  
  22.  
  23. def main():
  24. while True:
  25. passwd_from_user = get_passwd_from_user()
  26.  
  27. if len(passwd_from_user) < 8:
  28. print('8자 이상이어야 합니다.')
  29. elif not is_mixed(passwd_from_user):
  30. print('숫자 문자 특수문자가 1자 이상 포함되어야 합니다.')
  31. else:
  32. print('정상적인 패스워드 입니다.')
  33. break
  34.  
  35.  
  36. if __name__ == '__main__':
  37. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement