June 2025
Intermediate to advanced
515 pages
17h 5m
English
In Python, two constructs exist for implementing repetitive structures: the while loop and the for loop. Loop constructs are always needed when a statement block must be executed multiple times, for example, when value tables for mathematical functions or when rectangle sums must be calculated for numerical integration.
A while loop consists of the loop head and the statement block or loop body that is supposed to be repeated. This loop has the following general structure:
while condition: statement1 statement2 statement3 ...
The loop body can consist of one or more statements. The statements of the loop body are executed as long as the condition is True, and its execution is aborted if the ...
Read now
Unlock full access