Input/Output CS Thinking Example 1
Follow the full solution, then compare it with the other examples linked below.
Example 1
easyIdentify the inputs and outputs in this program: name = INPUT('What is your name?'). age = INPUT('How old are you?'). OUTPUT 'Hello ' + name + ', you are ' + age + '.'
Solution
- 1 Step 1: Inputs are data the program receives from the user. Here there are two inputs: name and age.
- 2 Step 2: The OUTPUT statement displays a message to the user โ this is the program's output.
- 3 Step 3: The program takes two inputs (name and age) and produces one output (a greeting message).
Answer
Inputs: name and age (from user). Output: a personalised greeting message.
Input is data entering a program (keyboard, file, sensor). Output is data leaving a program (screen, file, speaker). Every useful program has at least one input or output.
About Input/Output
The mechanisms by which a program receives data from the outside world (input) and sends results back (output). Input can come from keyboards, files, sensors, or network connections; output can go to screens, files, printers, or other devices.
Learn more about Input/Output โMore Input/Output Examples
Example 2 medium
A temperature converter takes a Celsius value as input and outputs the Fahrenheit equivalent. Write
Example 3 mediumA program reads a list of 5 test scores and outputs the average. Identify the inputs, process, and o
Example 4 hardDescribe three different input devices and three different output devices a computer program might u