Getting everything ready for you…

Loading courses, problems and your progress. This takes just a moment.

0s

Projects › Beginner

Password Generator & Strength Checker

A desktop tool that generates secure passwords and rates the strength of any password with tips to improve it.

Level: Beginner · Time: 2–3 days · Tech stack: Python, secrets, Tkinter

Features to build

What you will learn

Step-by-step guide

1. Generate securely

Use secrets, not random — random is predictable.

import secrets, string
def generate(length=16, symbols=True):
    pool = string.ascii_letters + string.digits + (string.punctuation if symbols else '')
    while True:
        pw = ''.join(secrets.choice(pool) for _ in range(length))
        if any(c.isdigit() for c in pw) and any(c.isupper() for c in pw):  # make sure it mixes types
            return pw

2. Score strength

def strength(pw):
    score = min(len(pw), 20) // 4                              # length matters most
    score += sum(any(f(c) for c in pw) for f in (str.islower, str.isupper, str.isdigit))
    score += any(c in string.punctuation for c in pw)
    if pw.lower() in COMMON: score = 0                          # e.g. "password123"
    return ['Very weak', 'Weak', 'Okay', 'Strong', 'Very strong'][min(score // 2, 4)]

Load COMMON from a list of the 10,000 most common passwords.

3. Tips

Return reasons too: "add a symbol", "use 12+ characters", "this is a common password".

4. GUI

Tkinter: an Entry for length, Checkbuttons for symbols, a Button to generate, a Label for the strength (coloured), and root.clipboard_append(pw) for copying.

5. Package

pyinstaller --onefile app.py makes a single .exe you can share.

Level it up

On your resume

Learn on Codify