⌨️ Input

4th Grade 💻 Coding

Input is information that comes into a program from outside: typing on a keyboard, clicking a mouse, touching the screen, talking into a microphone, or opening a file.

Free · US Letter · no sign-up
Google Classroom Save to Pinterest Email me

Almost every program follows the pattern “input → processing → output”: it gets information, does something with it, and gives back a result. A calculator gets numbers (input), calculates (processing) and shows the answer (output). Scratch has an “ask … and wait” block, and the reply is saved in the “answer” block.

In Python, name = input("What is your name? ") shows a question, waits for the user to type, and saves what they typed. Important: input always returns a string. If you need a number, convert it: age = int(input("How old are you? ")). And always think: what if the user types something unexpected?

For example

  • In a game, the arrow keys are input that moves the character.
  • A voice assistant takes spoken input and turns it into text the program can work with.
  • In Scratch, “ask What’s your name? and wait” collects input, and then the sprite says “Hello” together with the answer.

📌 Remember: Input goes in. Output comes out.

Quick quiz

  1. What is input?

  2. What does input() return in Python?

  3. What pattern do most programs follow?

🔎 Ask Thinkapedia another question