Whitespace characters are invisible spacing elements such as spaces, tabs, and line breaks. They can improve readability, separate fields, or determine source-code structure. section 4.1 section 21.4.3
Whitespace matters in several practical ways:
- Python uses indentation, rather than braces, to define the bodies of loops and conditional clauses. section 4.1
- Extra spaces at line beginnings or around fields can interfere with loading and processing data. section 21.4.3
- Tabs and spaces can be visually similar while producing troublesome or inconsistent input. section 21.4.3
- Additional whitespace can make code easier to read, although formatting choices should remain purposeful. section 5.9.3
Indentation as structure
In Python, the indented statements belong to the while loop: n = 9 r = 1 while n > 0: r = r * n n = n - 1 Removing that indentation changes which statements are inside the loop. In contrast, C uses braces for structure, so indentation alone can be rearranged without changing execution. section 4.1
# This is Python code.
n = 9
r = 1
while n > 0:
r = r * n #1
n = n - 1 #2
Inspect a compact Python example where whitespace and indentation delimit the loop body. section 4.1


