Skip to main content
Problem 3

Password Strength Tagger

EASYBUILD
Strings+2

Implement tag_password_strength(password) that returns a strength label. Return "invalid" if the password contains any whitespace. Otherwise count how many character categories appear: lowercase, uppercase, digit, symbol. Return "weak" if len < 8 or fewer than 2 categories; "medium" if 8 <= len <= 11 with at least 2 categories; "strong" if len >= 12 with at least 3 categories.

Examples
Example 1
Input
password = "Abcdef12"
Output
"medium"
Note

Length 8, contains uppercase, lowercase, and digits — 3 categories.

Example 2
Input
password = "Abc 12345"
Output
"invalid"
Note

Contains a space.

Constraints
  • 0 <= len(password) <= 200
  • password may contain any ASCII characters
Hints
Related Practice
Track
Backend Basics

Keep moving through related backend basics problems and build a stronger search-friendly practice loop around this topic.

View track →
Console output will appear here...