Skip to content
    Hack The FutureHack The FuturePython Notes

    UNIT 01 · TOPIC 15

    Indentation

    Indentation groups statements into a block; Python conventionally uses four spaces per level.

    The idea

    Indentation, simply explained

    Indentation groups statements into a block; Python conventionally uses four spaces per level.

    01

    See the big picture

    How the idea flows

    Input or goalIndentationPython result
    Understand the problemApply IndentationRun the codeCheck the output

    Read the diagram as a simple path: begin with a problem, use the Python idea, then verify the result.

    02

    Everyday connection

    Real-life example

    ↗

    A neatly indented outline makes it clear which actions belong under a condition.

    03

    Learn by doing

    Python code example

    PYTHONExample
    temperature = 31
    if temperature > 30:
        print('Hot day')
    Expected resultHot day
    Try it: Change one value in the code, predict what will happen, then run it and compare your answer.
    04

    Keep this in mind

    Key takeaways

    • Indentation groups statements into a block; Python conventionally uses four spaces per level.
    • Think of a real problem where indentation could save time or organize information.
    • Test small changes and read the result carefully before moving to a bigger program.

    Quick self-check

    Can you explain it in your own words?

    What is the main idea of Indentation?

    Indentation groups statements into a block; Python conventionally uses four spaces per level.

    Where could you see this idea in everyday life?

    A neatly indented outline makes it clear which actions belong under a condition.

    Keep learning · Hack The Future