🐍 [Day 1] check_password()

April 20, 2026

Morning! πŸ˜ƒ β˜•οΈ

Every time you make an account, something behind the screen looks at your password and decides: weak, medium, or strong.

This week, you're going to be that something. You'll learn one small, real Python function - check_password() - that reads a password and returns exactly that verdict.

Here's how the week works: today you see the whole function. Each morning after, a few lines quietly disappear. By Friday only the bones are left and you fill in the rest from memory. No flashcards, no drills - you just keep the function.

In today's email...

THE FUNCTION 🐍

def check_password(password):
    if len(password) < 8:
        return "Weak"
    has_number = False
    for char in password:
        if char.isdigit():
            has_number = True
    if has_number:
        return "Strong"
    return "Medium"

TODAY'S LINE πŸ’­

Nothing is blanked yet - so today let's walk the whole flow once, top to bottom.

def check_password(password): gives the function a name and says "hand me a password to look at."

The first check is a shortcut: if len(password) < 8: asks "is it shorter than 8 characters?" If so, it's "Weak" - and return stops the function right there. Nothing else needs to run.

If it survives that, we look for a number. has_number = False starts with the assumption "no digits yet." Then for char in password: walks through the password one character at a time, and if char.isdigit(): flips has_number to True the moment it finds one.

At the end, the verdict: if the password had a number, it's "Strong"; if it got this far without one, it's "Medium".

Short password β†’ Weak. Long with a number β†’ Strong. Long without β†’ Medium. That's the whole idea.

WITH ADA β˜•

Reading code is good. Running it is when it clicks.

Meet Ada, your companion over at py-and-jam.com. Paste this function in and she'll run it for you - no setup, no installing anything - so you can watch it actually work.

Try it on three passwords: something short, your real one, and something long with a number in it. Watch the verdict change.

ANSWER KEY βœ…

Today's blanked lines: none - Day 1 is always the full function.

def check_password(password):
    if len(password) < 8:
        return "Weak"
    has_number = False
    for char in password:
        if char.isdigit():
            has_number = True
    if has_number:
        return "Strong"
    return "Medium"

See you tomorrow - the first lines start disappearing. 🐍 The Py & Jam Team

There's a better way to learn.

Py & Jam delivers one memorable disappearing function to your inbox daily. It’s a simple, effective way to build fluency without the frustration.