-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasswordStrengthChecker.py
More file actions
32 lines (25 loc) · 972 Bytes
/
PasswordStrengthChecker.py
File metadata and controls
32 lines (25 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import re
def is_strong_password(password):
# Check if the password is at least 8 characters long
if len(password) < 8:
return False
# Check if the password contains at least one uppercase letter
if not re.search(r'[A-Z]', password):
return False
# Check if the password contains at least one lowercase letter
if not re.search(r'[a-z]', password):
return False
# Check if the password contains at least one digit
if not re.search(r'\d', password):
return False
# Check if the password contains at least one special character
if not re.search(r'[!@#$%^&*()_+{}|:"<>?`\-=[\];\',./]', password):
return False
# If all checks pass, the password is considered strong
return True
# Example usage
password = input("Enter your password: ")
if is_strong_password(password):
print("Strong password!")
else:
print("Weak password. Please follow the password strength guidelines.")