+ 1

Password validation problem..

Can you please point out my mistakes? string= input() firstTest= string.isalnum() ex= string.count("!") ha= string.count("#") st= string.count("*") ad= string.count("&") dl= string.count("

quot;) pr= string.count("!") at= string.count("@") secondTest= ex+ha+st+ad+dl+pr+at lenght= len(string ) if firstTest == False : if secondTest >1 : if lenght >=7: print ("Strong") else : print ("Weak") else : print ("Weak") else : print ("Weak") Remains two test cases😭

4th Apr 2020, 11:55 AM
Dolani Johnson Tobi
Dolani Johnson Tobi - avatar
2 Antworten
+ 2
you must test if the password has at least 2 numbers. what you did will work even if the password has no number. the isalnum method returns true if each character of the string is either a letter or a number
4th Apr 2020, 12:06 PM
John Robotane
John Robotane - avatar
+ 1
Thanks. I'll look into it
4th Apr 2020, 1:20 PM
Dolani Johnson Tobi
Dolani Johnson Tobi - avatar