[SOLVED] (Code Coach)Password Validation is not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[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

22nd Jan 2020, 5:47 PM
Prakhar Srivastava
Prakhar Srivastava - avatar
22 Answers
+ 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👍
23rd Jan 2020, 6:48 AM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 3
Prakhar Srivastava Don't be sorry, you worked out the problem. Well done. Honours to Jayakrishna for his assistance
23rd Jan 2020, 7:58 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Rik Wittkopp Thank you....
23rd Jan 2020, 9:18 AM
Jayakrishna 🇮🇳
+ 2
Can you show your code? Or else specify which one going wrong... And pls tag language you are trying...
22nd Jan 2020, 6:04 PM
Jayakrishna 🇮🇳
+ 2
What is that error? Show me.. Add in code.. Other than that every thing seems perfect...
23rd Jan 2020, 6:43 AM
Jayakrishna 🇮🇳
+ 2
Rik Wittkopp thanx to you also for looking into the problem.Cheers 👍
23rd Jan 2020, 3:32 PM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 2
Adam Szekely yes you are absolutely correct 👍
24th Jan 2020, 3:50 PM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 1
Are you allowing for Upper and Lower case letters?
22nd Jan 2020, 6:24 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Jayakrishna i have posted the code,the upper link has the question and lower link has the solution.
23rd Jan 2020, 3:30 AM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 1
Rik Wittkopp the question does not have any boundation on the case of letters.
23rd Jan 2020, 3:32 AM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 1
Prakhar Srivastava The input you should give by Scanner methods not by command line arguments...
23rd Jan 2020, 6:39 AM
Jayakrishna 🇮🇳
+ 1
Jayakrishna yes i know i initially tried with Scanner class but it shows an error in the creation of Scanner object.
23rd Jan 2020, 6:42 AM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 1
Prakhar Srivastava It's OK... Fine, Not a ploblem at all.. You are always Welcome...
23rd Jan 2020, 6:54 AM
Jayakrishna 🇮🇳
+ 1
Jayakrishna that's so considerate of you.Thanx again 👍✌️🙂
23rd Jan 2020, 6:57 AM
Prakhar Srivastava
Prakhar Srivastava - avatar
+ 1
my neym is anonim xarjerbord
24th Jan 2020, 1:20 PM
dertser
+ 1
ktota yest
24th Jan 2020, 1:20 PM
dertser
+ 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.
1st Apr 2020, 2:34 PM
Jayakrishna 🇮🇳
10th Oct 2022, 2:41 AM
Neeraj Kumar
Neeraj Kumar - avatar
0
#please check what I'm doing wrong p=str(input()) p.strip() #remove spaces say='Weak' spchar=['!', '@', '#', '
#x27;, '%', '&', '*'] 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)
1st Apr 2020, 2:08 PM
yogesh nandal
yogesh nandal - avatar
0
Jayakrishna🇮🇳 thanks a lot buddy. I will take care of it in future.
1st Apr 2020, 2:37 PM
yogesh nandal
yogesh nandal - avatar