-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword_verification_corrected.py
More file actions
41 lines (33 loc) · 1.31 KB
/
password_verification_corrected.py
File metadata and controls
41 lines (33 loc) · 1.31 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
password =input("Enter your password: ")
def password_verification(password):
letters = "abcdefghijklmnopqrstuvwxyz"
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special = "!@#$%&"
digit = "0123456789"
has_lowercase = False
has_uppercase = False
has_special = False
has_digit = False
password_length = len(password)
if password_length < 8:
print("Password should comtain atleast 8 characters")
for char in password:
if char in letters:
has_lowercase = True
elif char in upper:
has_uppercase = True
elif char in special:
has_special = True
elif char in digit:
has_digit = True
if not has_lowercase:
print("Must contain atleast one lowercase letter")
elif not has_uppercase:
print("Must contain atleast one uppercase letter")
elif not has_special:
print("Must contain atleast one special character")
elif not has_digit:
print("Must contain atleast one number")
else: #(has_lowercase == True and has_uppercase == True and has_special == True and has_digit == True)
print("Valid Password!")
password_verification(password)