Knowee
Questions
Features
Study Tools

Check if a string is matching password requirements Sample inputProgram#123Sample outputSuccessfully Matched with the Password Requirements.ExplanationRead a string which should satisfy the password requirements.If the string satisfies the given requirements print "Successfully Matched with the Password Requirements." without double quotes.if not satisfied print "Not Matched with the Password Requirements." without the double quotes.Password Requirements :Atleast one Uppercase character.Atleast one Lowercase character.Atleast one special Character.Atleast one Number.The string should be more than 8 characters long. SAMPLE INPUT:  Program#12SAMPLE OUTPUT:Successfully Matched with the Password Requirements.Note:Your code must be able to print the sample output from the provided sample input. However, your code is run against multiple hidden test cases. Therefore, your code must pass these hidden test cases to solve the problem statement.

Question

Check if a string is matching password requirements Sample inputProgram#123Sample outputSuccessfully Matched with the Password Requirements.ExplanationRead a string which should satisfy the password requirements.If the string satisfies the given requirements print "Successfully Matched with the Password Requirements." without double quotes.if not satisfied print "Not Matched with the Password Requirements." without the double quotes.Password Requirements :Atleast one Uppercase character.Atleast one Lowercase character.Atleast one special Character.Atleast one Number.The string should be more than 8 characters long. SAMPLE INPUT:  Program#12SAMPLE OUTPUT:Successfully Matched with the Password Requirements.Note:Your code must be able to print the sample output from the provided sample input. However, your code is run against multiple hidden test cases. Therefore, your code must pass these hidden test cases to solve the problem statement.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

To solve this problem, we can use Python's built-in functions and the re (regular expressions) module. Here is a step-by-step solution:

  1. Import the re module.
  2. Define a function that takes a string as an argument.
  3. Inside the function, check if the length of the string is less than 8. If it is, return "Not Matched with the Password Requirements."
  4. Use the search function from the re module to check if the string contains at least one uppercase letter, one lowercase letter, one number, and one special character. If it doesn't, return "Not Matched with the Password Requirements."
  5. If the string passes all these checks, return "Successfully Matched with the Password Requirements."

Here is the Python code that implements these steps:

import re

def check_password(password):
    if len(password) < 8:
        return "Not Matched with the Password Requirements."
    elif not re.search("[a-z]", password):
        return "Not Matched with the Password Requirements."
    elif not re.search("[A-Z]", password):
        return "Not Matched with the Password Requirements."
    elif not re.search("[0-9]", password):
        return "Not Matched with the Password Requirements."
    elif not re.search("[_@$#]", password):
        return "Not Matched with the Password Requirements."
    else:
        return "Successfully Matched with the Password Requirements."

print(check_password("Program#12"))

This code will print "Successfully Matched with the Password Requirements." for the input "Program#12".

This problem has been solved

Similar Questions

Check if a string is matching password requirements Sample inputProgram#123Sample outputSuccessfully Matched with the Password Requirements.ExplanationRead a string which should satisfy the password requirements.If the string satisfies the given requirements print "Successfully Matched with the Password Requirements." without double quotes.if not satisfied print "Not Matched with the Password Requirements." without the double quotes.Password Requirements :Atleast one Uppercase character.Atleast one Lowercase character.Atleast one special Character.Atleast one Number.The string should be more than 8 characters long. SAMPLE INPUT:  Program#12SAMPLE OUTPUT:Successfully Matched with the Password Requirements.Note:Your code must be able to print the sample output from the provided sample input. However, your code is run against multiple hidden test cases. Therefore, your code must pass these hidden test cases to solve the problem statement.

Python program to check the validity of username and password input by users

special Character.Atleast one Number.The string should be more than 8 characters long. SAMPLE INPUT:  Program#12SAMPLE OUTPUT:Successfully Matched with the Password Requirements.Note:Your code must be able to print the sample output from the provided sample input. However, your code is run against multiple hidden test cases. Therefore, your code must pass these hidden test cases to solve the problem statement.LimitsTime Limit: 5.0 sec(s) for each input fileMemory Limit: 256 MBSource Limit: 1024 KBScoringScore is assigned if any testcase pas

Develop a Java program that creates a simple GUI application for a passwordvalidator. The program should allow users to input a password and check ifit meets certain criteria.Requirements:Window with password input, "Check Password" button, result label.Validate password: ≥8 chars, ≥1 uppercase, ≥1 lowercase, ≥1 digit.(7)

Develop a python function using regular expression for validating a password.Password should contain at least one capital letter, one number and one special character like @$!%*#?&Length of the password should be between 8 and 18.Sample Input:XdsE83&!2Sample Output:ValidSample Input:asDf#$Q$$Invalid

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.