Sequence, conditionals and loops
Selection and repetition determine which program statements execute.
Key knowledge
In the stated Python model, a sequence runs in order unless control is redirected. An if/elif/else statement selects the first true branch, or its else branch if none is true. A while statement tests before each iteration and repeats its body while the test remains true.
Conditions and scope
- Expressions used as tests follow the language's truth-value rules.
- A loop can execute zero times or fail to terminate; changing state alone does not prove termination.
Sources · 3
References
Sources retain their recorded scope. A source link alone does not establish verification of every statement.
Evidence and review
Selection and repetition determine which program statements execute.
2026-10-10 · Independent Physics and Measurement reference editor (AI editorial bounded review). Exact bounded introductory reference claims and this practical concept inventory are approved after closure. Existing university/research proof and source scopes remain separate; no universal knowledge-completeness or experimental-validation assertion.
Foundational review
2026-10-10 · Independent AI editorial inspection of this new compact reference entry, its equations, applicability, sources and knowledge connections.
Sources from other places
Agreement within this scope
First-matching Python branches and pretest while loops, including zero iterations.
The examples also show a nonterminating loop; changing state alone is not a termination argument.
University of Helsinki, Agile Education Research Group2 sources
- Python Programming MOOC · Else and elif FinlandEnglish
Else and elif
- Python Programming MOOC · Loops with conditions FinlandEnglish
While loops with conditions; Infinite loop
- Python Programming MOOC · Else and elif
Entry details
Permanent link to this entry ↗- Record identity
- foundation-info-control-flow
- Revision
- foundations-audit.1
- Structured reference record
- Foundational core completion