Organising Code

Organising Code#

These lessons describe how to write code efficiently by organising it into conditional statements, loops, functions, and importing modules.

When we are talking about for loops more generally we use the following terms:

  • Discrete variable: a variable changes its value at every iteration of the loop (e.g. temperature_C in task 3).

  • Iterator: a variable containing multiple values, which can be used in a for loop (e.g. temperature_measurements in the last example). Lists are the most common kind of iterator in Python.