Why does my code not work (Python Password Validation) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does my code not work (Python Password Validation)

x=input() y=['!', '@', '#', '

#x27;, '%', '&', '*'] a=0 b=0 if len(x)>=7: for i in x: if i.isdigit(): a+=1 elif i in y: b+=1 print("Strong" if a>=2 and b>=2 else "Weak") It gets all but one of the tests right but it won't tell me the input or expected output for that test Edit: Solved

23rd Mar 2023, 11:20 AM
Tanner
Tanner - avatar
1 Answer
+ 8
Tanner , > if the *length* of the password is less than 7 characters, there is no message printed. > this can be fixed with an else clause for the line *if len(...)...*, that has to be placed at the end of the code
23rd Mar 2023, 12:03 PM
Lothar
Lothar - avatar