How to solve it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to solve it?

You're interviewing to join a security team. They want to see you build a password evaluator for your technical interview to validate the input. Task: Write a program that takes in a string as input and evaluates it as a valid password. 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

23rd Feb 2021, 3:33 AM
SammE
SammE - avatar
6 Answers
+ 2
Please always post your attempt so we can help you improve. 🌟ᴀɴᴜʀᴀɢ[STUDY 📚]🌟 method of solving it is correct and I have attached how I solved it in a similar method. Here is how I solved the problem: https://code.sololearn.com/cyFFgWA0f5bu/?ref=app
23rd Feb 2021, 5:46 AM
Elijah Brown
Elijah Brown - avatar
+ 2
Rostislav Khalilov Steps: 1.=>Make array of special characters 2.=>Take Password from the input and story in it any variable name as per your choice 3.=>Make 3 Variables like: numbChar,numLette,numInt And store 0 in it 4.Use for loop to transverse the user input password 5.Use condition ( i )=>if char in chars: add one to numbChar and like this use isDigit() and isAlpha() 6.=>and in last add one condition if (numbChar>=2 && numbint>=2 && len(password)>=7{ Console.write("Strong "); else{ Console.write(" Weak"); } If I have done any mistake in above programming then sorry for that because all function which is used are python because I have learn python.so thanks for giving me chance to help you😃😃
23rd Feb 2021, 4:16 AM
Anurag Kumar
Anurag Kumar - avatar
+ 1
Rostislav Khalilov I think this is your code coach 1st show your attempt than we can tell what is wrong with your code.Then we can help if you have not attempt than go and take paper ,pencil and eraser write what the code coach is.saying and after that write on your paper and try again if again there is any problem then tell us
23rd Feb 2021, 3:43 AM
Anurag Kumar
Anurag Kumar - avatar
+ 1
the problem is that I don't know how to solve it
23rd Feb 2021, 3:56 AM
SammE
SammE - avatar
+ 1
Ok
23rd Feb 2021, 4:11 AM
SammE
SammE - avatar
0
Wait....I am telling
23rd Feb 2021, 4:03 AM
Anurag Kumar
Anurag Kumar - avatar