-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstpach.py
More file actions
25 lines (14 loc) · 695 Bytes
/
stpach.py
File metadata and controls
25 lines (14 loc) · 695 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
#A Python script that checks if a password is strong
#at least 8 digits, both uppercase and lowercase letters and at least one number.
import re
eght_char_long = re.compile(r'(\w|\W){8,}')
has_low = re.compile(r'[a-z]{1,}')
has_up = re.compile(r'[A-Z]{1,}')
has_dig = re.compile(r'(\d){1,}')
while True:
pwd = input("Enter a password.\n")
if eght_char_long.search(pwd) == None or has_low.search(pwd) == None or has_up.search(pwd) == None or has_dig.search(pwd) == None:
print("Your password is not strong. Try again")
else:
print("Your password is strong. Good job!")
break