PY
py
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
#Thanks for your likes!
#Verify the strength of password
#Returns a dictionary indicating the wrong criteria
#A password is considered strong if:
#8 characters length or more
#1 digit or more
#1 symbol or more
#1 uppercase letter or more
#1 lowercase letter or more
import re
def password_check(password):
# calculating the length
length_error = len(password) < 8
# searching for digits
digit_error = re.search(r"\d", password) is None
# searching for uppercase
uppercase_error = re.search(r"[A-Z]", password) is None
# searching for lowercase
lowercase_error = re.search(r"[a-z]", password) is None
# searching for symbols
symbol_error = re.search(r"[!@#$%&'()*+,-./[\\\]^_`{|}~"+r'"]', password) is None
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run