Skip to main content
🐍 Python Projects

Password Strength Checker

What you're building

A PasswordChecker that evaluates a password against common rules and returns a score and a list of improvement hints.

Requirements

check(password) returns a dict:

{
  "score": int,   # 0–4 (one point per rule met)
  "hints": list   # rules that were NOT met
}

Rules (1 point each):

  1. At least 8 characters long
  2. Contains an uppercase letter
  3. Contains a digit
  4. Contains a special character (!@#$%^&*())
pc = PasswordChecker()
pc.check("hi")
# {"score": 0, "hints": ["at least 8 characters", "uppercase letter", "digit", "special character"]}
pc.check("Secure1!")
# {"score": 4, "hints": []}

Stretch goals

  • Penalise common passwords like "password" or "123456".
  • Add a strength_label() that maps score to "weak"/"fair"/"strong"/"very strong".

What this proves

String inspection, boolean flags, list building, and dict construction β€” building-block skills for any auth or security feature.

⚑ 50 XP
solution.pyRuns in your browser (Pyodide)
Loading editor…
Tests4 to pass
weak password scores 0
strong password scores 4
missing digit noted in hints
short password flagged

Run your code to check these.