code block
The group of indented statements under a heading such as def, if, for or while, which run together as one unit.
In more detail
The block starts after the heading's colon and ends at the first line indented less. Blocks can be nested inside blocks, each level indented further.
Related terms
- indentation — The spaces at the start of a line, which in Python decide which statements belong inside a def, if, for or other block.
- compound statement — A statement such as if, for, while, def, class, try or with that has a heading ending in a colon and an indented block beneath it.
- nesting — Putting one control statement inside another, such as an if inside a for loop, with each level indented further.
Taught in
- Installing Python On Windows — Hands-on Python: Complete Video Course & Book
- Multiple Parameters — Hands-on Python: Complete Video Course & Book
- Lists, Range And The For Loop — Hands-on Python: Complete Video Course & Book
- Conditions And Simple If Statements — Hands-on Python: Complete Video Course & Book
- Chapter Three In One Sitting — Hands-on Python: Complete Video Course & Book