Password validation help Code Coach | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Password validation help Code Coach

Hi guys 1/13 test case test case gets failed please review my code and let me know Testcase 4 failed https://code.sololearn.com/c51O9XO3a7dO

23rd Apr 2020, 4:43 AM
kartik narang
kartik narang - avatar
2 ответов
+ 2
The alpha check isn't needed It only cares that the the length is Greater than or equal to 7 That there are at least 2 numbers And at least 2 special characters. You may need to trim the white space from the ends of the input string. Try using a variable for the output string and set it to "Weak" Then wrap your for loop in an if statement thats condition checks the strings length. If it's too short no reason to run the loop. Your for loop should parse over each char as it does and if the char is either a number or special character increment the relevant counter. If while in the for loop both counters are 2 or greater set output string to Strong and break. After if block surrounding loop output result.
23rd Apr 2020, 5:30 AM
ChaoticDawg
ChaoticDawg - avatar
0
thankyou Chaotic. All I did is trim the spaces before and after string . You can review my code it passed all the test cases
23rd Apr 2020, 12:13 PM
kartik narang
kartik narang - avatar