References: Control Flow, Functions, and Modules
-
Control flow - Wikipedia - Surveys how programs choose and repeat actions through conditionals, loops, and subroutines. It gives the big picture behind this chapter's if/elif/else decisions and the for and while loops used in every clock program.
-
Function (computer programming) - Wikipedia - Explains functions, also called subroutines: reusable named blocks with parameters and return values, plus how calls work. It supports this chapter's sections on arguments, returns, and code modularity.
-
Modular arithmetic - Wikipedia - Introduces arithmetic that wraps around at a fixed value and uses the 12-hour clock as its main example. It underpins the chapter's Wrap-Around Dial and the remainder operator for seconds and minutes.
-
Automate the Boring Stuff with Python (2nd Edition) - Al Sweigart - No Starch Press - Sweigart explains if, else, elif, and while statements with flowcharts that show every path a program can take. These diagrams make conditionals and loops visual for beginners.
-
Structure and Interpretation of Computer Programs (2nd Edition) - Harold Abelson and Gerald Jay Sussman, with Julie Sussman - MIT Press - Introduces the idea of procedures as black-box abstractions, using a substitution model to trace calls. It clarifies why this chapter packages code into functions and modules.
-
More Control Flow Tools - Python Documentation - The official tutorial on if statements, for loops, range, break and continue, and defining functions with arguments. It is an authoritative companion to the chapter's decision, loop, and function sections.
-
machine - functions related to the hardware - MicroPython Documentation - The reference for the machine module, which provides Pin, Timer, and other hardware control. It supports the chapter's import statements, modules, and machine module sections.
-
Functions (Think Python) - Allen Downey, Think Python online - A free chapter on defining and calling functions, parameters, local variables, and stack diagrams of function calls. It adds a second explanation of this chapter's function concepts.
-
Python while Loop - Programiz - Explains while loops with code visualization, including infinite loops, break, and continue. It helps students trace the always-running loop at the heart of every clock program in this chapter.
-
Python Try Except - W3Schools - Short runnable examples of try, except, else, and finally blocks for handling errors. It supports the chapter's error handling section so a clock does not crash on a bad value.