Example 1 — Label a thermostat's inputs and outputs
Show the steps and the answer
List what enters the program: the sensor reading 18 and the target 20 from the settings file.
Both come from outside the program's code, one from a device and one from storage, so both are input.
Do the processing: 18 < 20 is true, so the decision is heater on.
The comparison happens inside the program and crosses no boundary, so it is neither input nor output.
List what leaves the program: the signal that switches the heater on, the 18 shown on the screen, and the line '18 ON' written to the log file.
Output is anything sent out, to a device, a screen or a file, not just text on a display.
Answer: Inputs: the sensor reading 18 °C and the target 20 °C from the settings file. Processing: 18 < 20, so heat. Outputs: the heater-on signal, 18 on the screen, and '18 ON' in the log file.
Takeaway: Files can be input in one step and output in another. Label each piece of data by the direction it crosses the program's edge.