-1

Having a problem in password validation (code coach)

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

2/16/2020 4:42:50 PM

s pal

9 Answers

New Answer

+1

s pal I am sorry that I was harsh to you. It just seemed to me that you created the question immediately after creating the code. Since this is not the case I apologize to you. Did you change the condition in line 29? It should be if(c >= 2 && k >= 2) and not if(c >= 2 && c >= 2) I guess then your code should work. The rest seems fine to me. Just a tip for numbers. The Character class has a nice method: isDigit() If a character is a digit it returns true, else false. So you can also write: if(Character.isDigit(a)){ k++; }

+8

And because I just noticed it: You created the code before 41 minutes You created the question before 40 minutes. Code is not working -> ask question. This is not you should do it to get a good programmer. code is not working -> debug -> ask question if you can't find the bug. It is just a suggest. But I think you should spend more time on your code.

+7

s pal Please remove the pings. I think it would get annoying if everybody would do that. I would only accept a ping if nobody answers you. line 29: if(c >= 2 && c >= 2)

+2

Denise Roßberg If I had been quite rude in my words,then I am sorry. As for that silly mistake , I just completely overlooked it and had thought of some problem in logic

+1

s pal No Problem :) Making breaks are important. If you stare at a code for too long, you don't see anything. In most cases you just see what you expect. For me it helps to do a break for at least one hour where I close the app and do something else. Then looking at the code again: "What have I done here?" :D Bugs happens and I guess it will never end. ;) But over the time you will learn how to find your bugs.

0

Denise Roßberg Can you help me

0

Coder Kitten Can you help me

0

Denise Roßberg It's annoying to endure such hard words since I tried to find the bug in code coach and then thought of putting the question . And we can not direct to code coach solution directly so I need to copy it to create a code bit. Only then I had put the question. It's not what you are thinking . Also for your suggest , I would humbly say that I am not a good programmer rather would have others help me to understand test conditions better.

0

Denise Roßberg Good to see you have completed 71 code coach problems but would rather suggest to be not a passive braggart and show that you are a good observer.