Functions and structured code

Writing functions, parameters and return values, scope, decomposition and abstraction, libraries and modules: a robot program broken into named pieces.

Module F4GCSE6 lessons

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