Advertisement
Merevoli

Untitled

Apr 29th, 2022
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import string
  2.  
  3. password = input()
  4. have_lowercase_char = False
  5. have_uppercase_char = False
  6. have_digit_char = False
  7. have_special_char = False
  8. have_valid_length = False
  9.  
  10. special_chars = "$#@"
  11.    
  12. for char in password:
  13.     if char in string.ascii_lowercase:
  14.         have_lowercase_char = True
  15.     elif char in string.ascii_uppercase:
  16.         have_uppercase_char = True
  17.     elif char in string.digits:
  18.         have_digit_char = True
  19.     elif char in special_chars:
  20.         have_special_char = True
  21.    
  22. if 6 <= len(password) <= 16:
  23.     have_valid_length = True
  24.    
  25. if have_lowercase_char and have_uppercase_char and have_digit_char and have_special_char and have_valid_length:
  26.     print("YES")
  27. else:
  28.     print("NO")
  29.        
  30.    
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement