Advertisement
jootiee

Untitled

Mar 13th, 2022
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. password = input()
  2.  
  3. contains_uppercase = False
  4. contains_lowercase = False
  5. contains_digit = False
  6. contains_other = False
  7. for sym in password:
  8.     contains_digit = sym.isdigit() or contains_digit
  9.     contains_lowercase = (sym.lower() == sym) or contains_lowercase if sym.isalpha() else contains_lowercase
  10.     contains_uppercase = (sym.upper() == sym) or contains_uppercase if sym.isalpha() else contains_uppercase
  11.     if not (sym.isdigit() or sym.isalpha()):
  12.         contains_other = True
  13.         break
  14. if contains_uppercase and contains_digit and contains_lowercase and (not contains_other):
  15.     print("Пароль валидный")
  16. else:
  17.     print("Пароль невалидный")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement