Skip to content

Commit 54eacb1

Browse files
create strong_password_detection.py
1 parent 17059b7 commit 54eacb1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

strong_password_detection.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
def strong_password_detection(password):
2+
3+
AllowedSymbols = ['#', '@', '$', '_', '*', '-']
4+
flag = 1
5+
# length of the entered password should be at least 6
6+
if len(password) < 6:
7+
print('length of the entered password should be at least 6')
8+
flag = 0
9+
# length of the entered password should be not be greater than 15
10+
if len(password) > 15:
11+
print('length of the entered password should be not be greater than 15')
12+
flag = 0
13+
# The entered password should have at least one numeral
14+
if not any(char.isdigit() for char in password):
15+
print('The entered password should have at least one numeral')
16+
flag = 0
17+
# Password should have at least one lowercase letter
18+
if not any(char.islower() for char in password):
19+
print('the entered password should have at least one lowercase letter')
20+
flag = 0
21+
# The entered password should have at least one uppercase letter
22+
if not any(char.isupper() for char in password):
23+
print('The entered password should have at least one uppercase letter')
24+
flag = 0
25+
# The entered password should have at least one of the symbols $@#_*
26+
if not any(char in AllowedSymbols for char in password):
27+
print('The entered password should have at least one of the symbols $@#_*')
28+
flag = 0
29+
if flag:
30+
return flag
31+
32+
33+
def main():
34+
password = input()
35+
36+
if (strong_password_detection(password)):
37+
print("The entered password is strong !!")
38+
else:
39+
print("The entered password is weak !!")
40+
41+
42+
if __name__ == '__main__':
43+
main()

0 commit comments

Comments
 (0)