File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments