Created
July 16, 2018 09:28
-
-
Save solen003/fe5a35f33b9c5301fa5287c9c11aeb2e to your computer and use it in GitHub Desktop.
A website requires the users to input username and password to register. Write a program to check the validity of password input by users. Following are the criteria for checking the password: 1. At least 1 letter between [a-z] 2. At least 1 number between [0-9] 1. At least 1 letter between [A-Z] 3. At least 1 character from [$#@] 4. Minimum len…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
passwords = input("Type in: ") | |
passwords = passwords.split(",") | |
accepted_pass = [] | |
for i in passwords: | |
if len(i) < 6 or len(i) > 12: | |
continue | |
elif not re.search("([a-z])+", i): | |
continue | |
elif not re.search("([A-Z])+", i): | |
continue | |
elif not re.search("([0-9])+", i): | |
continue | |
elif not re.search("([!@$%^&])+", i): | |
continue | |
else: | |
accepted_pass.append(i) | |
print((" ").join(accepted_pass)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
s=input("enter sequence of comma separated passwords :")
import re
l=s.split(",")
for i in l:
if(len(i)>=6 and len(i)<=12):
if re.search("([a-z])+", i):
if re.search("([A-Z])+", i):
if re.search("([0-9])+", i):
if re.search("([#,@,$])+", i):
print(i)
#other method