Advertisement
go6odn28

validate_password

Feb 14th, 2024
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. import re
  2.  
  3. def validate_password(password):
  4.     if len(password) < 8:
  5.         return False
  6.     if not re.search("[a-z]", password):
  7.         return False
  8.     if not re.search("[A-Z]", password):
  9.         return False
  10.     if not re.search("[0-9]", password):
  11.         return False
  12.     return True
  13.  
  14. password = input()
  15. if validate_password(password):
  16.     print("Valid password")
  17. else:
  18.     print("Invalid password")
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement