Free lab Real Python 3. Zero installs. Your code stays in this browser. Open the playground

Password Strength Auditor

Build the password checker every signup form runs: length rules, character variety, a scoring engine, and a batch audit that flags weak passwords.

Beginner 4 steps 90 XP ~35 min

How it works in the real world

When a signup form says "password too weak", this is the code behind it:

  1. Rules — small boolean functions, one per rule (length, digits, case…).
  2. Scoring — combine rule results into a score, map score → rating.
  3. Batch audit — run the scorer over many passwords and report the weak ones, exactly what a security team does after a breach.

Small pure functions composed into a pipeline — this is professional code structure in miniature.

Build progress0 / 4 steps
1

The length rule

Write is_long_enough(pw) returning True when the password has at least 10 characters. Print the result for "secret" and "correcthorse".

Blank · autosaved
PYstep_1.py
Run your code to check this step…
2

The variety rule

Write has_variety(pw): True only if the password contains at least one digit, one uppercase and one lowercase letter. Test on "password1" and "Password1".

Blank · autosaved
PYstep_2.py
Run your code to check this step…
3

The scoring engine

Write strength(pw): score +1 each for length ≥ 10, any digit, any uppercase, any symbol from !@#$%^&*. Return "weak" (0–1), "okay" (2–3) or "strong" (4). Test the three prints.

Blank · autosaved
PYstep_3.py
Run your code to check this step…
4

The batch audit

Run the auditor over the list: print each weak password as name: weak, then a summary 2 of 4 passwords need changing.

Blank · autosaved
PYstep_4.py
Run your code to check this step…
Your next ten minutes

Write Python that does something useful.

Start free. No install, no card, no passive video marathon.

Start learning free → Explore the path