forked from fenyx-it-academy/Class5-Python-Module-Week4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword.py
More file actions
23 lines (23 loc) · 850 Bytes
/
Password.py
File metadata and controls
23 lines (23 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import re
password= input("Input your password: ")
val = True
while True:
if (len(password)<6 or len(password)>12): #this is password rule
raise ValueError("Not a Valid Password") # if there is an error,it will show error message
break
elif not re.search("[a-z]",password): #this is password rule
raise ValueError("Not a Valid Password")
break
elif not re.search("[0-9]",password): #this is password rule
raise ValueError("Not a Valid Password")
break
elif not re.search("[A-Z]",password): #this is password rule
raise ValueError("Not a Valid Password")
break
elif not re.search("[$#@]",password): #this is password rule
raise ValueError("Not a Valid Password")
break
else:
print("Valid Password")
val = False
break