Is there anyone that knows the input of test case 10 & 11 of password validation challenge in Code Coach section | SoloLearn: Learn to code for FREE!

0

Is there anyone that knows the input of test case 10 & 11 of password validation challenge in Code Coach section

Task: Write a program that takes in a string as input and evaluates it as a valid password. The password is valid if it has at a minimum 2 numbers, 2 of the following special characters ('!', '@', '#', '$', '%', '&', '*'), and a length of at least 7 characters. If the password passes the check, output 'Strong', else output 'Weak'. Input Format: A string representing the password to evaluate. Output Format: A string that says 'Strong' if the input meets the requirements, or 'Weak', if not. I am solving it with python... Kindly help me out.

1/18/2020 1:35:09 PM

Akintobi Idris A.

4 Answers

New Answer

+1

They are hidden for everybody.

+1

Use search 🔎 in code section...

0

Thanks... Too bad...Thought some moderators can see the hidden parts.... Anyone that pass all the test cases should kindly share the code with me... Will be glad to learn more... I didn't use any module tho

0

import java.util.*; class PasswordValidator { public static void main(final String[] args) { int is1 = 0; int is2 = 0; int is3 = 0; Scanner sc = new Scanner(System.in); String s = sc.nextLine(); char ch[] = s.toCharArray(); int n = s.length(); int nnum=0; int ns=0; for(int i=0;i<n;i++) { if(n<7) { is1 = 0; break; } else if(n>=7) { is1 = 1; } if(Character.isDigit(ch[i])) { nnum++; if(nnum>=2) { is2 = 1; } else { is2 = 0; } } if(ch[i]=='!' || ch[i]=='@' || ch[i]=='#' || ch[i]=='%' || ch[i]=='$' || ch[i]=='&' || ch[i]=='*') { ns++; if(ns>=2) { is3 = 1; } else { is3 = 0; } } } if(is1==1 && is2==1 && is3==1) System.out.print("Strong"); else if(is1==0 || is2==0 || is3==0) System.out.print("Weak"); } }