25 | Password Strength Indicator |
Functions help you abstract away complex operations, but they also help you build reusable components.
Create a program that determines the complexity of a given password based on these rules:
-
A very weak password contains only numbers and is fewer than eight characters.
-
A weak password contains only letters and is fewer than eight characters.
-
A strong password contains letters and at least one number and is at least eight characters.
-
A very strong password contains letters, numbers, and special characters and is at least eight characters.
Example Output
| The password '12345' is a very weak password. |
| The password 'abcdef' is a weak password. |
| The password 'abc123xyz' is a strong password. |
| The password '1337h@xor!' ... |
Get Exercises for Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.