def, Parameters, and return

Scenario: The same health calculation appears in five scripts.

New words, in plain English

Define with def. A function call creates local parameter names. return ends the call; without an explicit return, Python returns None.

Analogy: A Python program is like a clear set of instructions for a careful helper: names label things, indentation groups steps, and errors explain where the helper became confused.

A small, real example

def healthy(status_code):
    return 200 <= status_code < 400

print(healthy(204))
Tip: Prefer functions that return useful values over functions that only print.
Goal: Practice this idea in the py-first-function challenge at /labs/python. Fix the broken program, run it yourself, then use check to prove the real end state.