Level 1
0 / 100 XP

Planning before you code

The hardest part of a small program is often the blank screen. A simple plan removes that fear: decide what goes in, what happens in the middle, and what comes out — before you write real code.

The input - process - output (IPO) method

Almost every program fits this shape:

  1. Input — the data you start with (often hard-coded values while you learn).
  2. Process — the steps that transform that data (loops, conditionals, functions).
  3. Output — what you print or return at the end.

Ask three questions and write the answers down as comments first:

Python
# INPUT: a list of scores # PROCESS: find the average, then decide pass/fail # OUTPUT: print the average and the result

Sketch with comments, then fill them in

Turn each step into a comment, then write the code under it. The comments become your to-do list:

Python
# INPUT scores = [70, 85, 90, 60] # PROCESS: average total = sum(scores) avg = total / len(scores) # PROCESS: pass or fail result = "pass" if avg >= 70 else "fail" # OUTPUT print(f"Average: {avg:.1f} -> {result}") # Average: 76.2 -> pass

Build a tiny version first, then grow it

Don't try to write the whole thing at once. Get the smallest piece working, run it, then add the next step. For the example above:

  1. First just print(scores) — confirm the data is there.
  2. Then compute and print the average.
  3. Then add the pass/fail decision.
  4. Then format the final output.

Running after each small step means bugs show up one at a time, where they're easy to fix.

Key takeaways

  • Plan with input -> process -> output before writing real code.
  • Write each step as a comment first, then fill in the code beneath it.
  • Build the smallest working version, run it, then grow it one step at a time.