Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- class PasswordValidation:
- @staticmethod
- def strong_password(strong_password):
- has_digit = True if re.search('\d', strong_password) else False
- has_up = True if re.search("[A-Z]", strong_password) else False
- has_low = True if re.search("[a-z]", strong_password) else False
- test_len = len(strong_password) >= 12
- test_123 = "123" not in strong_password
- result = has_digit and has_up and has_low and test_len and test_123
- return result
- print(PasswordValidation.strong_password("Strong3Password")) #Strong password
- print(PasswordValidation.strong_password("strong1password")) #Weak password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement