Password Validator
You are tasked to create a password validation system. If the password does not meet the following criteria, a
ValueError
should be raised with an appropriate error message of what went wrong (see the examples):- The password must have at least 8 characters.
- The password must contain at least 1 number.
- The password must include at least 1 uppercase letter.
- The password must have at least one special character (
.,:;!?()[]{}<>+=-*%/$^|@#&_~`
).
If the password passes all checks, the program should print:
Your password is valid!
Input | Output |
abcdefg | ValueError: The password must have at least 8 characters. |
abcdefgh | ValueError: The password must contain at least one number. |
abcdefgh1 | ValueError: The password must include at least one uppercase letter. |
Abcdefgh1 | ValueError: The password must have at least one special character. |
Abcdefgh1! | Your password is valid! |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB