Skip to content

Commit b9724e1

Browse files
authored
Add files via upload
1 parent 501b209 commit b9724e1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import re
2+
3+
def check_password_strength(password):
4+
strength = 0
5+
6+
if len(password) >= 8:
7+
strength += 1
8+
if re.search('[a-z]', password):
9+
strength += 1
10+
if re.search('[A-Z]', password):
11+
strength += 1
12+
if re.search('[0-9]', password):
13+
strength += 1
14+
if re.search('[@#$%+=!]', password):
15+
strength += 1
16+
17+
return strength
18+
19+
20+
def main():
21+
password = input('Enter a password: ')
22+
strength = check_password_strength(password)
23+
24+
if strength == 5:
25+
print('Password strength: Very Strong')
26+
elif strength == 4:
27+
print('Password strength: Strong')
28+
elif strength == 3:
29+
print('Password strength: Medium')
30+
elif strength == 2:
31+
print('Password strength: Weak')
32+
else:
33+
print('Password strength: Very Weak')
34+
35+
36+
37+
38+
if __name__ == '__main__':
39+
main()

0 commit comments

Comments
 (0)