What is missing in my code? | SoloLearn: Learn to code for FREE!

+5

What is missing in my code?

I am solving Password Validation Challange and My code fails at Test case 1, 5 , and 9. But I don't know why !! Help me out. https://code.sololearn.com/c8miE87tvzPe/?ref=app

1/13/2020 11:01:39 AM

乡Ashutosh°^°Kumar乡

29 Answers

New Answer

+5

use v = set(x.strip()) instead of split()

+5

you are not checking for special characters like "#&@" and capital letters.

+5

乡Ashutosh°^°Kumar乡 that is because the methog you counted the rest of the characters is wrong, same problem again. If you change the part where you count the special characters, it will work fine. Why is the idea behing using set() ? It seems only disturbing to me, and unecessary.

+4

From what I see, your code does not count the number of special characters. It only counts the number of characters that are different that numbers and alphabets, and not those specific characters.

+4

乡Ashutosh°^°Kumar乡 it is probably because of how you counted the letters. You removed the alphabets and numbers to get the last missing number of characters. The space counts as a character, and therefore might be the reason a condition is True.

+4

bahha🐧 I was about to write that 👌

+2

乡Ashutosh°^°Kumar乡 as said before, you are counting all the characters, and not just those special characters. Even ¥ would be counted in m, but it does not exist in special characters, so your code is wrong.

+2

srry I dont do python i do c++ though

+2

I have to learn python but not getting it in my mind

+2

Mikhail actually no, it's "What is wrong with my code?" 乡Ashutosh°^°Kumar乡 I already answered and told you what I think was wrong, why don't you give it a try ?

+2

乡Ashutosh°^°Kumar乡 I answered that post as well.

+1

Aymane Boukrouh [INACTIVE] m3lm 👌

+1

Can you explain that why strip() works but split() don't.? How strip () function works? Explain me please.

+1

strip() removes whitespace characters like space, tab. when no parameter is used. I just thought of it when you mentioned, it worked without space anyway the code would work without strip() too. set(x)

+1

+1

Ajay Dayma I know nothing about cpp xD

+1

l = set(alpha) | set(digit) i used In place of (| = & ) Then checked it shows strong password given in your code

+1

Может проверяют терпение?

+1

0

Kindly see the code. I am storing the alphabets in a list. Then digits in a different list. Then I am subtracting these both lists from my input and storing it in variable m. Now I counting alphabets, digits, and m ( special characters). Then what is wrong here.. check it again guys Aymane Boukrouh [INACTIVE] bahha🐧