Introduction to Python – Control Flow
- Python’s for statement iterates over the items of any sequence (a list or a string), in the order that they appear in the sequence.
- Iterating over a sequence of numbers
Breaks out of the innermost loop.
- Loop statements may have an else clause.
- Using for or when the condition becomes false with while, but not when the loop is terminated by a break statement.
- The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action.
- It can also be used as a placeholder for a future class definition.
- A function definition associates the function name with the function object in the current symbol table. The interpreter recognizes the object pointed to by that name as a user-defined function. Other names can also point to that same function object and can also be used to access the function.