In: Computer Science
Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!):
#python package to find patterns
import re
#inputs comma separated passwords
input_password = str(input("Enter passwords : "))
#append those passwords into a list
password_list = input_password.split(",")
#list to store valid passwords
password_valid=[]
#iterate over all the passwords in the list
for password in password_list:
#checks all the given conditons
if(len(password)>6 and len(password)<12):
if(re.search("[a-z]",password)):
if(re.search("[A-Z]",password)):
if(re.search("[0-9]",password)):
if(re.search("[$#@]",password)):
#if all the conditons are satisfied it will be appended into list
password_valid.append(password)
#prints passwords comma separated
print(','.join(map(str,password_valid)))
Enter passwords : ABd1234@1,,a F1#,2w3E*,2We3345,ABd1234@2
ABd1234@1,ABd1234@2
...Program finished with exit code 0
i hope the answer is clear and satisfactory.
if you have any doubts feel free to ask in comment section
please give me a thumbs up