🐍 Python for Everyone

← Back to interview questions

Chapter 6 Project 35 min build

Password Strength & Policy Auditor

A menu-driven mini-app that scores a password against five real policy rules and tracks session stats — built entirely out of string methods, iteration, and the accumulator pattern from Chapter 5. This one's genuinely resume-worthy.

Example run

Output
=== Password Strength & Policy Auditor ===

1. Check a password
2. View session stats
3. Quit
Choose an option (1-3): 1
Enter a password to check: abc

--- Result for 'abc' ---
Score: 1/5  ->  Rating: Weak
Checklist:
  [ ] At least 8 characters long
  [ ] Contains an uppercase letter
  [x] Contains a lowercase letter
  [ ] Contains a digit
  [ ] Contains a special character (!@#$%^&*()-_=+)
Suggestions:
  - Make it at least 8 characters long
  - Add an uppercase letter
  - Add a digit
  - Add a special character, e.g. one of !@#$%^&*()-_=+

1. Check a password
2. View session stats
3. Quit
Choose an option (1-3): 2

--- Session Stats ---
Passwords checked: 1
Strong passwords: 0
Strong rate: 0.0%

1. Check a password
2. View session stats
3. Quit
Choose an option (1-3): 3

Session summary: checked 1 password(s), 0 rated Strong.
Goodbye!
What you're building A while True menu loop with three options: check a password, view session stats, or quit. Checking a password scores it out of 5 against length, uppercase, lowercase, digit, and special-character rules — all checked with string methods and a single for loop over its characters, no re module needed. Session stats use the accumulator pattern: a running count of passwords checked and how many were rated Strong.
How to run Download starter.py below and run python3 starter.py.

The five rules

Each satisfied rule is worth one point. A score of 0-2 is rated Weak, 3-4 is Medium, and 5 is Strong. The tool also prints exactly which rules were missed — not just the score — so the feedback is actionable.

Ideas to make it your own

Why this project matters

Password policy checks like this run in real signup forms, admin panels, and security tooling every day. The logic here is small on purpose — a single pass over each character, a handful of booleans, an accumulator for stats — but it's the same shape as production validation code: clear rules, specific feedback, and a running record of what happened.

← Interview Questions All Chapters →