Studyfin Studyfin ✨ Sign up free

Input & output basics

Grade 7 · Coding · Free lesson

Hey there! Ready to learn how computers talk to us and how we talk to them? Let's explore inputs and outputs!

Every computer program needs a way to get information and show results. We use a design process to plan these programs. First, we define the problem we want to solve, like making a game or a helpful tool.

ai generated

An input is information we send to the computer. This can be a button click, typing on a keyboard, or even a sensor detecting light. In block-based coding, we use 'event' blocks to listen for these inputs.

Input: Pressing a Button

An output is what the computer does or shows in response. This could be a sound, a flashing light, or text on a screen. Programs use conditionals (like 'if-then' blocks) to decide which output to show.

Output: Screen Text> Hello, World!> Program ready...
✏️ Worked example

Let's design a program for an automatic night light. We want a light bulb (output) to turn on only when a sensor detects that the room is dark (input). How do we plan this using a design process?

  1. Define the Problem: We need to turn a light on when it is dark, and off when it is bright.
  2. Identify the Input: The input is the light level from a sensor. We can measure this as a number.
  3. Identify the Output: The output is the light bulb turning ON or OFF.
  4. Write the Logic (Conditional): We use an 'if-then-else' plan. IF the light level is less than 5, THEN turn the bulb ON. ELSE, turn the bulb OFF.
  5. Create the Loop: We put this logic inside a continuous loop so the computer constantly checks the sensor.
chalk
Want the full interactive lesson — quiz, animations, and Finn cheering them on?

More Coding lessons