0

I'm stuck on the password validation challenge. Would anyone be able to explain the issue with this code please?? 😁

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

6th Nov 2020, 10:17 PM
Max Hill
Max Hill - avatar
3 Antworten
+ 2
The password 1234567 is in this code „strong“ which is not true.
6th Nov 2020, 10:49 PM
JaScript
JaScript - avatar
+ 2
Maximus Hillius very nice idea / approach, i really like it!! But that there are some issues with any()... 1. You cant simply multiply by 2... This lead to true * 2, when x is digit, or false *2, when x is not digit... 2. special_characters is always true (even more, when doubled :)), thats why it simply does not matter, whether you use a special char or not... Try replacing your rules for this: rules = [lambda p: len(p) >= 7, lambda p: sum(x.isdigit() for x in p) >= 2, lambda p: sum(x in special_characters for x in p) >= 2]
7th Nov 2020, 12:07 AM
G B
G B - avatar
+ 1
Thank you both so much!! It's been bugging me for a long time 😅
27th Nov 2020, 3:33 PM
Max Hill
Max Hill - avatar