Program to check password (strong or weak) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Program to check password (strong or weak)

This program takes an input as password from the user and the program check that the password is strong or weak. The password is valid if it has at a minimum 2 numbers, 2 of the following special characters ('!', '@', '#', '

#x27;, '%', '&', '*'), and a length of at least 7 characters. If the password passes the check, output 'Strong', else output 'Weak'. Input Format: A string representing the password to evaluate. Output Format: A string that says 'Strong' if the input meets the requirements, or 'Weak', if not. Sample Input: Hello@$World19 Sample Output: Strong import re pswd = input() special = re.sub ("[!@#$%&*]", "", pswd) nums = re.sub ("[\d]", "", pswd) if len(pswd) < 7 or len(special) == len(pswd) or len(nums) == len(pswd): print ("Weak") else : print ("Strong")

31st Jul 2021, 3:42 AM
Parthasarathi Panda
Parthasarathi Panda - avatar
2 Answers
0
Hello Parthasarathi Panda, what exactly is your question? Do you want someone to write the code for you or explain how to do it?
31st Jul 2021, 4:22 AM
David Akhihiero
David Akhihiero - avatar
0
Ans is also there. Could you please explain the code
31st Jul 2021, 11:30 AM
Parthasarathi Panda
Parthasarathi Panda - avatar