Inputs and Outputs
In, Work, Out
Watch any computer, phone, or smart gadget long enough and you will see the same three-beat rhythm:
βββββββββββ βββββββββββββ ββββββββββββ
β INPUT β ββββΊ β PROCESS β ββββΊ β OUTPUT β
βββββββββββ βββββββββββββ ββββββββββββ
data goes in work happens result comes out
This is the inputβprocessβoutput (IPO) model, and it describes almost every system ever built:
| System | Input | Process | Output |
|---|---|---|---|
| Calculator | 3, Γ, 4 | multiply | 12 on screen |
| Music app | tap on a song | find and decode the file | sound from speaker |
| Thermostat | room temperature | compare with target | heating on/off |
| Quiz website | your answer | check against correct answer | "Correct!" |
Input Devices, Output Devices
Input devices send data into the computer:
- Keyboard β letters and numbers
- Mouse / touchscreen β position and taps
- Microphone β sound
- Camera β images
- Sensors β temperature, light, movement, GPS location
Output devices send results out to the world:
- Screen β text and images
- Speaker β sound
- Printer β pages
- Motors and lights β a robot arm moving, an LED turning on
A quick test for any device: which direction does the data flow? Into the computer = input. Out of the computer = output.
Input and Output in Algorithms
In pseudocode, two commands connect an algorithm to the outside world:
INPUT age (read a value, store it in the variable age)
OUTPUT age + 1 (send a result out β display it)
Trace it: the user types 9 β the variable age holds 9 β the process works out 9 + 1 β the output is 10.
In a flowchart, both input and output use the parallelogram symbol β data crossing the boundary of the algorithm, in either direction.
Worked Example β Smart Doorbell
A smart doorbell shows all three stages working together:
- Input β the motion sensor detects movement; the camera captures an image
- Process β the software decides: does this look like a person?
- Output β IF yes β send an alert to the owner's phone
Notice the process step usually combines inputs with stored values (like a sensitivity setting). That is why the same input can produce different outputs on different days β the stored settings changed, not the rules.
Garbage In, Garbage Out
A famous computing saying: "garbage in, garbage out" (GIGO). An algorithm can be perfectly correct and still give a wrong answer β if the input was wrong.
Type your birthday wrong into a form and the site will calculate the wrong age, flawlessly. Good systems therefore check inputs before processing: is this date real? is this number sensible? When an answer looks wrong, debugging starts with the question: was the input right?
Validating Input Before It Causes Trouble
Because GIGO is such a reliable source of bugs, real systems add a checking step right after input arrives, before any processing happens:
INPUT age
IF age < 0 OR age > 120 THEN
OUTPUT "That doesn't look like a valid age β try again"
ELSE
(continue processing normally)
ENDIF
This is input validation, and it is one of the very first defensive habits professional programmers build. Notice that it is really just a condition guarding the input, the same IF structure from elsewhere in this course, now aimed specifically at catching nonsense before it can corrupt a result. This connects directly to the "erroneous data" category in testing programs: a well-tested program is one where somebody deliberately tried typing letters into a number field, or β1 into an age field, and confirmed the system responds sensibly rather than crashing or quietly producing garbage.
Worked Example β A Multi-Step IPO Chain
Real systems rarely stop at one round of input-process-output β the output of one stage often becomes the input to the next, chained together:
Input: raw microphone audio
Process: convert sound wave into text (speech recognition)
Output: the recognised words, as text
β
βΌ (becomes the next stage's input)
Input: the recognised text
Process: work out what the user wants (search? play music? set a timer?)
Output: an action, like "playing your song now"
A voice assistant is really two IPO cycles chained end to end, and larger systems can chain many more. Recognising this chained structure is useful decomposition: instead of one overwhelming "understand human speech and do the right thing" problem, it becomes two separate, more manageable input-process-output stages, each testable on its own.
Key Words
- Input β data entering a system (from keyboards, sensors, clicksβ¦)
- Process β the work that turns inputs into results
- Output β the result leaving a system (screens, speakers, motorsβ¦)
- Sensor β an input device that measures the real world
- GIGO β "garbage in, garbage out": wrong inputs produce wrong outputs