indentation

The spaces at the start of a line, which in Python decide which statements belong inside a def, if, for or other block.

In more detail

All lines of one block must be indented by the same amount, conventionally four spaces. Moving a line back out, dedenting, ends the block, so indentation changes what the program means, not only how it looks. Inconsistent indentation raises IndentationError.

Related terms

Taught in

References

Certification courses