+ 1

Password Validating Problem

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. i have made this script, but it doesn't work with the 8th case. I searched for a flaw in the script, but; it all seems correct. Some idea? https://code.sololearn.com/c05O865cLwZI/?ref=app

20th Jun 2020, 10:13 AM
Biondi Tommaso
Biondi Tommaso - avatar
2 ответов
+ 2
Your code seems unnecessarily long and somewhat confusing. If that's easy for you then that's cool but I thought I'd share my ideas. What I did is create 3 counters. One for letters,symbols and numbers. I then evaluated with a for and if statements for each char in password. If it was a letter then the letter counter would +1. You should research and can use .isalpha(), .ispunct() and .isdigit() Finally use your counters to evaluate if each is high enough to print your output. Hope this helps ☺️
20th Jun 2020, 10:41 AM
Olivia
Olivia - avatar