+ 1
Password Validation -Python. I have written a code using python sets and lists and it says the test cases 10 and 11 are failed.
Can I please know the reason for it? Question 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 ('!', '@', '#', '
#x27;, '%', '&', '*'), 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. Here's my code word = list(input()) charcters = ['!', '@', '#', '#x27;, '%', '&', '*'] numbers = ["0","1","2","3","4","5","6","7","8","9"] z = set(word).intersection(set(charcters)) num = set(word).intersection(set(numbers)) if len(z) > 1 and len(word) > 6 and len(num) > 1: print("Strong") else: print("Weak")2 odpowiedzi
0
You are using set so it eliminates duplicates but its valid having repeated special characters or numbers ..
Ex: abc1111@@@@ is valid.