Indentation

In Python, spaces at the start of a line decide which block the line belongs to.

Also called: IndentationError, whitespace

Domain
Languages
Type
Term
Source
General
Language
Python

In plain English

Use 4 spaces, never mix tabs and spaces. "IndentationError" means a line is shifted wrong.

Example

The IndentationError came from one line with a tab instead of four spaces.

In code

if guests > 6:
    print("Big group")      # inside the if
print("Done")               # after the if

Learn more

Related terms

Added 2026-11-30 · Last reviewed 2026-11-30