[SOLVED] (Code Coach)Password Validation is not working | SoloLearn: Learn to code for FREE!

+3

[SOLVED] (Code Coach)Password Validation is not working

I have written the solution satisfying all the conditions but still it is failing 7/13 test cases. Can somebody please explain what is wrong in my solution Question : https://www.sololearn.com/coach/76?ref=app Solution : https://code.sololearn.com/caprhA3HfWdY/?ref=app

1/22/2020 5:47:20 PM

Prakhar Srivastava

20 Answers

New Answer

+4

Prakhar Srivastava Don't be sorry, you worked out the problem. Well done. Honours to Jayakrishna for his assistance

+3

Jayakrishna ok i am very sorry to waste your time.I actually forgot to import java.util package.Now it is working fine,all test cases passed.I apologize again.Thanx👍

+3

Rik Wittkopp Thank you....

+2

Can you show your code? Or else specify which one going wrong... And pls tag language you are trying...

+2

What is that error? Show me.. Add in code.. Other than that every thing seems perfect...

+2

Rik Wittkopp thanx to you also for looking into the problem.Cheers 👍

+2

When it comes to coding everything has to be perfect so there must be a problem with the coding itself or the import.

+2

Adam Szekely yes you are absolutely correct 👍

+1

Are you allowing for Upper and Lower case letters?

+1

Jayakrishna i have posted the code,the upper link has the question and lower link has the solution.

+1

Rik Wittkopp the question does not have any boundation on the case of letters.

+1

Prakhar Srivastava The input you should give by Scanner methods not by command line arguments...

+1

Jayakrishna yes i know i initially tried with Scanner class but it shows an error in the creation of Scanner object.

+1

Prakhar Srivastava It's OK... Fine, Not a ploblem at all.. You are always Welcome...

+1

Jayakrishna that's so considerate of you.Thanx again 👍✌️🙂

+1

my neym is anonim xarjerbord

+1

ktota yest

+1

yogesh nandal Better to make your own question always.. Also your question is python.. So Try these first then make question or use search bar for python answer... First if it length is less than 7, need to print Weak, and stop further execution so exit there otherwise it prints 2 times Weak. Next remove 10 and 15 lines. It executing length of input times instead of only 1 time.. By these changes, your code works fine.

0

#please check what I'm doing wrong p=str(input()) p.strip() #remove spaces say='Weak' spchar=['!', '@', '#', '$', '%', '&', '*'] nums=['0','1','2','3','4','5','6','7','8','9'] if len(p)<7: print(say) a,b=[],[] for i in range(len(p)): for j in range(len(spchar)): x=p.count(spchar[j]) #count all chars-p if(x!=0): str(a.append(x)) #store non-0 result for o in range(len(p)): for k in range(len(nums)): #count all num-p y=p.count(nums[k]) if(y!=0): str(b.append(y)) #store non-0 result c,n=sum(a),sum(b) #sum of all chars/nums found if (c>=2 and n>=2): say='Strong' print(say)

0

Jayakrishna🇮🇳 thanks a lot buddy. I will take care of it in future.