🐍 [Day 5] check_password()

April 24, 2026

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

This is it.

Only the bones are left - the def line, the loop header, and the two return verdicts. Everything in between is yours to write.

Don't scroll ahead. Look at the skeleton below and fill in the whole body from memory: the length check, the flag, the loop that hunts for a number, and the decision at the end.

However it comes out, you've done something most people learning to code never do: you didn't copy a function. You kept one.

In today's email...

THE FUNCTION 🐍

def check_password(password):
    ____________________
        ____________________
    ____________________
    for char in password:
        ____________________
            ____________________
    ____________________
        return "Strong"
    return "Medium"

TODAY'S LINE πŸ’­

Today the whole body is blank, so let's assemble it in order - four pieces you've already learned:

  1. The length check. if len(password) < 8: β†’ return "Weak". Catch the too-short passwords first and stop.

  2. The flag. has_number = False. Start by assuming there's no digit.

  3. The loop. for char in password: walks each character, and if char.isdigit(): β†’ has_number = True flips the flag the moment it finds a number.

  4. The decision. if has_number: β†’ return "Strong", otherwise fall through to return "Medium".

Read those four beats once, then look away and write them into the skeleton. That's the real skill you built this week - not memorizing characters, but understanding a function well enough to rebuild it. That transfers to every function you'll ever write.

WITH ADA β˜•

Write your full check_password() from memory first - no peeking - then hand it to Ada at py-and-jam.com.

She'll check it for you: run it, compare the verdicts, and point out anything that's off. If it runs clean and the results make sense, you've got it - cold.

ANSWER KEY βœ…

Today's blanked lines - everything but the frame:

    if len(password) < 8:
        return "Weak"
    has_number = False
        if char.isdigit():
            has_number = True
    if has_number:

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"

That's a real, working Python function - and it's yours now. A new one lands Monday morning: another everyday problem, solved in a handful of lines you'll keep the same way. Rest your hands this weekend. You've earned it. 🐍 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.