Check the Password

You are working as a developer in a company that is serious about the security of its user accounts. You are tasked to create a password validation function check_password(password) which will throw custom exceptions for various password errors:
  • PasswordTooShortError: If the password length is less than 8 characters
  • PasswordMissingNumberError: If the password does not contain at least one number
The main job of your function is to enforce these rules and raise the appropriate exceptions if a provided password does not meet the criteria. If the password is longer than 8 characters and contains at least one number, it should return True.
Input
Output
securePassw0rd
Password is valid.
mypass
PasswordTooShortError: The password is too short, it should be at least 8 characters long.
securepassword
PasswordMissingNumberError: The password should contain at least one number.
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue