-
Notifications
You must be signed in to change notification settings - Fork 2
/
Password_Validation_Checker.py
86 lines (48 loc) · 2.2 KB
/
Password_Validation_Checker.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def Password():
capital_letters = 0
small_letters = 0
symbols = 0
numbers = 0
Password = input("Enter your password: ")
capitalalphabets="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
smallalphabets="abcdefghijklmnopqrstuvwxyz"
specialcharacters="$@_%&#"
digits="0123456789"
if (len(Password) >= 8):
for i in Password:
if (i in smallalphabets):
small_letters += 1
if (i in capitalalphabets):
capital_letters += 1
if (i in digits):
numbers += 1
if(i in specialcharacters):
symbols += 1
if (small_letters >= 1 and capital_letters >= 1 and numbers >= 1 and symbols >= 1 and small_letters + capital_letters + numbers + symbols == len(Password)):
print("Your Password Is Valid")
#to know how many capital letters are in the password
# print("There Are",capital_letters,"Capital Letters In Your Password")
#to know how many small letters are in the password
# print("There Are",small_letters,"Small Letters In Your Password")
#to know how many number are in the password
# print("There Are",numbers,"Numbers In Your Password")
#to know how many symbol are in the password
# print("There Are",symbols,"Symbols In Your Password")
else:
print("Your Password Is Invalid")
def Password_Validator():
flag = True
while flag:
print(" ")
print("----------Welcome To The Password Validator-------------")
print(" ")
print(" ")
print("-----Want To Check Your Password If It Is Valid Or Not: ")
user_input = input('''Enter Y To Check Password
Enter E To Exit ''').lower()
if user_input == 'y':
Password()
else:
print("Exiting.........")
break
Password_Validator()