Control flow

Python has a whole range of control flows to control code execution and programme flow, including common branches and loops:

Boolean values and expressions

check values and identity and allow links between the two.

Conditional statements

execute the code block after the first true condition of an if or elif statement; if neither condition is true, the code block is executed after the else.

Loops

While while loops are executed as long as the condition is true, for loops iterate over Lists, Tuples and Sets.

Exceptions

usually deal with errors that occur during the execution of programmes.

Context management with with

regulates access to files, the locking of threads and the suppression of Exceptions, among other things.