Python's control flow begins with the if statement, written as if condition: followed by an indented block. The condition is evaluated for truthiness; in Python, non-empty and non-zero values are considered truthy, while empty collections, zero, and None are falsy. To chain additional conditions, you can use elif (else-if) clauses, and a final else clause executes when no prior conditions match.
Loops allow you to repeat actions. The while loop, written as while condition:, repeatedly executes its indented block as long as the condition remains truthy. Care must be taken to avoid infinite loops by ensuring the condition eventually becomes false. The for loop, written as for item in iterable:, iterates over sequences such as lists, strings, or the numbers produced by range(). The expression range(n) generates the sequence from 0 to n-1.
Three special statements give you fine-grained control within loops. The break statement exits the loop entirely, while continue skips the rest of the current iteration and proceeds to the next one. The pass statement is a no-op placeholder, useful when syntax requires a statement but no action is needed, such as defining an empty class or function body.