Skip to content

04-07: Password Strength Checker & Generator

Python: Fundamentals

View the live site — ijk37.com

Project 07

Home  |  All Projects  |  Notes  |  Exercises  |  Quiz Hub

Analyses a password against 8 weighted criteria (length, character classes, repeats, common patterns) and produces a strength score from Weak to Excellent. Also generates cryptographically secure passwords using secrets.

Topics covered: string module · any() · lambda functions · list comprehensions · secrets module · f-strings · tuples · functions

Difficulty: ⭐⭐ Beginner–Intermediate


How to Run

python main.py

No external libraries — pure Python 3.


Sample Output

====================================================
    Password Strength Checker & Generator
====================================================

Options:
  1. Check a password
  2. Generate a strong password
  3. Quit

Choose: 1
Enter the password to check: MyP@ssw0rd!

════════════════════════════════════════════════════
  Password  : My*******!  (length: 11)
  Strength  : Good      🟡
  Score     : 7 / 10
────────────────────────────────────────────────────
  ✅  At least 8 characters  (+1)
  ✅  Contains lowercase letter  (+1)
  ✅  Contains uppercase letter  (+1)
  ✅  Contains a digit  (+1)
  ✅  Contains a special character  (+2)
  ✅  No repeated characters (3×+)  (+1)
  ❌  At least 12 characters
  ❌  No common patterns
════════════════════════════════════════════════════

Key Concepts Practised

Concept Where used
any(c.isupper() for c in p) Character-class checks
Lambda in data structure CRITERIA list of tuples
secrets module Secure password generation
Fisher-Yates shuffle Character ordering randomisation
string.ascii_letters etc. Character pool construction