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")3 ответов
+ 1
I guess it fail when input contains dublicate special symbols like " qwerty@@12". Because you are using set function which removes dublicates..
0
Yea, that seems to be the issue... Thanks
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")