+ 3

Password Validation (Code Coach) - Test cases #10 & #11 fail

Hello everyone, My code does not pass tests #10 and #11 in the code coach challenge Password Validation. Does somebody have an idea why not? Maybe someone can post the test cases' input? https://code.sololearn.com/cL7zBDDNWWEG/?ref=app Thanks

16th Nov 2023, 9:57 AM
Seban
Seban - avatar
7 Antworten
+ 9
Seban , the issue is how the code checks the special characters. it iterates over the tuple with the special characters and is using find() function. supposing there are 2 `@` as special chars, the current code will only find 1 of them. this can lead to `weak` as output. better to iterate over the password, and check if the character is in the special characters tuple. we can use the `in` operator instead of find().
16th Nov 2023, 11:17 AM
Lothar
Lothar - avatar
+ 8
.find() gets the first occurrence on the search character. Suppose you have a pw = "**aaaaa". Your code will find 1 "*" instead of 2.
16th Nov 2023, 11:12 AM
Lisa
Lisa - avatar
+ 4
Neku Raymond Create your own thread. Link your code. Describe exactly what it is supposed to do.
18th Nov 2023, 2:18 PM
Lisa
Lisa - avatar
+ 3
Ah of course. Thanks a lot to both of you. https://code.sololearn.com/cb2OtxnG62BZ/?ref=app
16th Nov 2023, 12:18 PM
Seban
Seban - avatar
0
I am not understanding anything please I need help
17th Nov 2023, 10:46 PM
Neku Raymond
Neku Raymond - avatar
0
Neku, it's easier to help if you let us know what you are struggling with.
18th Nov 2023, 11:19 AM
Seban
Seban - avatar
0
I'm just trying to write a simple code run numbers on phone screen
18th Nov 2023, 2:09 PM
Neku Raymond
Neku Raymond - avatar