2 ES TNS eal 2 Ir (|S a oe- ol a
€ Password Validation <
PROBLEM CODE RESULT
Password Validation
You're interviewing to join a security team. They
want to see you build a password evaluator for
your technical interview to validate the input.
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.
Sample Input:
Hello@$World19
Sample Output:
Strongry SI 4B alld 28% 8 5:44 pm
€ Password Validation ar
PROBLEM CODE RESULT
i
2 |def passchk(): aie
E}
4 spcr=(" !#@&*%" )
5 num=0
6 sp=0
a inpt=input("")
8
9 for i in range(len(inpt)):
10 try:
1 int(inpt[i])
iv Tal OTi ed O06 baal
rE]
ie except:
15 continue
16
Va
i} for ii in sper:
19 if ii in inpt:|
Py Sp=sp+1 }
Zi) else:
22 (ofol shemale
23
er if len(inpt)>=7 and num>=2 and sp>=2:
2a; return "Strong"
26 (Ulises
ras return "Weak"
Pa)
29 |print (passchk())
30