+ 2
Whts wrong with this password validation probelm
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() )
+ 1
Can you be more specific? Are you running into unintended behavior?
+ 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
+ 1
DavX thanks, will try
+ 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')
+ 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 😮💨
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