+ 2

Whts wrong with this password validation probelm

https://code.sololearn.com/crXmo4jjrEaI/?ref=app

26th Jan 2023, 3:00 PM
chetan kumar
chetan kumar - avatar
7 ответов
+ 2
Chetan, Don't split the string, then change your for loop to be: for i in x: That will make your code work, however - you can make it slightly more efficient (using counters, isalnum() and isdigit() )
26th Jan 2023, 3:47 PM
DavX
DavX - avatar
+ 1
Can you be more specific? Are you running into unintended behavior?
26th Jan 2023, 3:38 PM
Justice
Justice - avatar
+ 1
Tนktนk💕 Ya I too wrote the same thing i think 😅 but in place of counting, I created empty list and used length function
26th Jan 2023, 3:42 PM
chetan kumar
chetan kumar - avatar
+ 1
DavX thanks, will try
26th Jan 2023, 3:49 PM
chetan kumar
chetan kumar - avatar
+ 1
Here’s a full example ✌️: x = input() count_special = 0 count_num = 0 for i in x: if i.isdigit(): count_num += 1 if not i.isalnum(): count_special += 1 if count_special > 1 and count_num > 1 and len(x) > 6: print('Strong') else: print('Weak')
26th Jan 2023, 3:58 PM
DavX
DavX - avatar
+ 1
Scott D, difference is this person already got their code right - Improvement was suggested to their code after helping to fix. Suggest you remove the trumpet, or atleast slide it out a little 😮‍💨
28th Jan 2023, 4:26 AM
DavX
DavX - avatar
0
A full solution from DavX who recently wrote: "Don’t just post a solution, Mada will learn more from fixing their own attempt." Interesting. https://www.sololearn.com/Discuss/3187193/?ref=app
27th Jan 2023, 11:01 PM
Scott D
Scott D - avatar