Functions and structured code
Writing functions, parameters and return values, scope, decomposition and abstraction, libraries and modules: a robot program broken into named pieces.
Start in the simulator- F4.1 Writing functions def, calling, and why subprograms help.
- F4.2 Parameters and return values Information in and an answer out; procedures and functions.
- F4.3 Local and global variables Scope: where a variable exists, and why passing values beats global.
- F4.4 Decomposition and abstraction Structure diagrams, and hiding the details of a job behind a function.
- F4.5 Libraries and your own modules import, Python's own libraries, and a module file of your own.
- F4.6 Project: the patrol A complete program built a function at a time: patrol to the wall and come home.