GCSE · Computer Science · AQA · Spec 8525
Keyboard input
When a program asks you a question, it's doing something simple but powerful: it stops, waits for your answer, and keeps what you typed to use later.
Computer Science · Algorithms
Trace table — dry run the code
Aisha runs this little quiz. Step through it and watch what happens at each USERINPUT line: the program freezes until she types.
Ready when you are — step through one line at a time.
Predict, then check
Two users, one program.
A program has three lines: OUTPUT "Favourite food?", then food ← USERINPUT, then OUTPUT "Mmm, " + food + "!". Sam runs it and types pizza, and the screen ends with Mmm, pizza! Then Jo runs exactly the same program and types sushi. What does Jo's last line say?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
How a program stops, waits for you, and keeps what you typed
What you need to know
- An input line makes the program pause until the user types something and presses Enter.
- The typed value is stored in a variable: name ← USERINPUT stores it in name. (In Python the same idea is written name = input().)
- Later lines use the typed value by naming the variable, and it stays there until the program changes it.
- The programmer writes the input line, but the user supplies the value each time the program runs.
- Show a prompt with an OUTPUT line before the input, so the user knows what to type.
The big picture
Keyboard input lets a program get a value from the user while it is running. When the program reaches an input line, it stops and waits until the user types something and presses Enter. What they typed is stored in a variable, and any later line can use it by naming that variable. Because the value comes from the user rather than from the code, the same program can behave differently for different people.
Key points
Worked example
Problem
A program runs these three lines: OUTPUT "Which town do you live in?", then town ← USERINPUT, then OUTPUT "I hear " + town + " is lovely." The user types Leeds. What does the program output, in order?
⚠ Watch out
Thinking the input line shows something, or that the programmer decides its value. OUTPUT shows; USERINPUT collects. The value in town ← USERINPUT isn't known until someone types it.
Memory hook
Pause, store, use. Picture a waiter: they stop at your table and wait, write your order on their pad (the variable), and the kitchen cooks from the pad. The order comes from you, not from whoever printed the menu.
Check yourself
Without looking back: a program contains the line colour ← USERINPUT. What happens when the program reaches this line, and how can a later line use what the user typed?
Flashcards
(7)What does a program do when it reaches an input line?
In city ← USERINPUT, where does the typed value go?
How does a later line use what the user typed?
Who decides the value stored by name ← USERINPUT?
Why put an OUTPUT prompt before an input line?
What happens to typed input that isn't stored in a variable?
Why do programs take input at all?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 30 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.