Intermediate Python

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.
Password is valid.
PasswordTooShortError: The password is too short, it should be at least 8 characters long.
PasswordMissingNumberError: The password should contain at least one number.


Time limit: 0.2 seconds

Memory limit: 512 MB

Output limit: 1 MB

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