Stuck on 2 test cases!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Stuck on 2 test cases!!

Hey, I have searched through the forum and found this question but the answers didn't help me!! I have a python code the solves all but case 10 and 11... not sure why it is not passing those cases so any ideas would be great!! Here is code... password = input() special = ('!', '@', '#', '

#x27;, '%', '&', '*') pass_list = list(password) sp_condition = set(special) & set(pass_list) nums = sum(c.isnumeric() for c in password) if (len(password)) < 7 or (len(sp_condition)) < 2 or nums < 2: print("Weak") else: print("Strong")

5th Jul 2020, 5:58 PM
Eoin
3 Answers
+ 1
I guess it fail when input contains dublicate special symbols like " qwerty@@12". Because you are using set function which removes dublicates..
5th Jul 2020, 6:09 PM
Jayakrishna 🇮🇳
0
Yea, that seems to be the issue... Thanks
5th Jul 2020, 6:12 PM
Eoin
0
Sorted!! Changed how it assesses the special characters!! password = input() special = ('!', '@', '#', '
#x27;, '%', '&', '*') pass_list = list(password) sp_condition = 0 for i in range(0,(int(len(pass_list)))): if (pass_list[i] in special): sp_condition += 1 nums = sum(c.isnumeric() for c in password) if (len(password)) < 7 or (sp_condition) < 2 or nums < 2: print("Weak") else: print("Strong")
5th Jul 2020, 6:44 PM
Eoin