Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Validate password strength rules

Check password strength according to multiple rules and return a boolean.

Python practice17 minError Handling & Edge CasesIntermediateLast updated March 20, 2026

Problem statement

Create is_strong_password(password) -> bool that returns True if the password meets all of the following requirements, otherwise False: - Minimum length: 8 characters. - Contains at least one uppercase ASCII letter. - Contains at least one lowercase ASCII letter. - Contains at least one digit. - Contains at least one special character from the set: !@#$%^&*()-_+= - Does not contain any whitespace characters. - Is not one of a short list of common insecure passwords (e.g., 'password', '12345678', 'qwerty'). Function must handle non-string inputs by returning False and must not raise exceptions on unexpected inputs.

Task

Implement a password validator that enforces length, character variety, and common-password avoidance.

Examples

Valid password

Input

is_strong_password('Aa1!abcd')

Output

True

Meets length and contains uppercase, lowercase, digit, and special char.

Too weak

Input

is_strong_password('weakpass')

Output

False

Missing digit, uppercase and special character.

Input format

A single argument: password (expected string).

Output format

Return True if password is strong, otherwise False.

Constraints

- Only ASCII checks for letter/digit classification. - No external libraries. - Keep the common-password list short but reasonable.

Samples

Sample 1

Input

is_strong_password('Password1!')

Output

True

Typical acceptable strong password.