GCSE · Computer Science · Eduqas · Spec C500QS
Program a solution to requirements
Here is a program that runs perfectly, with no crash and no error message, and it still charges the wrong price. Can you work out why before you click anything?
Computer Science · Building to requirements
It runs. But is it right?
You are building the ticket-booth program one requirement at a time. Stages 1 and 2 already passed their checks, and you have just added Stage 3 (the lines for R3). Run it with 5 tickets, compare the cost with what R3 asks for, then pick the fix.
The whole program has four requirements. R1: ask how many tickets are wanted. R2: work out the cost at £8 a ticket and show it. R3: if 5 or more tickets are bought, take £10 off the cost. R4: print a numbered ticket for each ticket bought.
- # Stage 1: ask how many tickets are wanted
- tickets = int(input("How many tickets? "))
- # Stage 2: work out the cost, then show it
- cost = tickets * 8
- # Stage 3: £10 off for 5 or more tickets
- if tickets > 5:
- cost = cost - 10
- print("Cost: £" + str(cost))
Every message and output here is what Python 3.13 gives for this exact code, with 5 typed in.
Computer Science · Reading a requirement
Before any code: what does each requirement need?
Back to the ticket booth. For each part of its requirements, decide: is it an input, processing or an output?
Still to sort
Input (0)
Data that comes into the program from the user.
Where the line is: If the program works it out or decides it, it is not input.
Processing (0)
What the program does with the data: calculations and decisions.
Where the line is: If it is shown to the user, it is output; if it is typed in, it is input.
Output (0)
What the program shows or prints for the user.
Where the line is: The calculation behind a result is processing; only the shown result is output.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Build it one requirement at a time: run it, check it, fix it, then add the next bit.
What you need to know
- Programming a solution to requirements means writing a program whose behaviour satisfies every one of the requirements it has been given.
- Work through the requirements one at a time, identifying the inputs, processing and outputs each one needs.
- For each requirement, choose the constructs it needs, such as variables, input and output, sequence, selection (if statements) and iteration (loops).
Have a goA requirement says: "Keep asking for the password until the user types the right one." Which construct does it need: selection or iteration?
Iteration, so a loop.
A loop repeats code until something changes. Selection (an if statement) only decides once whether to run something.
- Build the solution in stages: get a small part that meets one requirement working first, then add code for the next one.
- At the end of each stage, run the program and check that the code you just wrote does what that requirement asks.
Have a goYour classmate runs their new code, sees no error message and shouts "Done!". Which part of the end-of-stage job have they skipped?
Checking that the code does what the requirement asks.
Running the stage is only half the job. The check is whether its output matches the requirement, not whether it avoided an error message.
- Running without a syntax error does not make a stage correct: its output must match the requirement, or it contains a logic error.
- Fix a failing stage before moving on. Only a little new code was added, so the error is easier to locate.
Have a goYou added 4 new lines and the stage fails its check. Everything before them passed its own check. Where do you look first?
In the 4 new lines.
Only that small amount of code is new since the last check, which is why the error is easier to locate than in a whole finished program.
- Once a new stage is added, check the earlier stages again to confirm that the requirements they met are still met.
- Keep track of which requirements have been met. The solution is complete only when every requirement is met by the program.
The big picture
To program a solution to requirements, you work through them one at a time: identify the inputs, processing and outputs, choose the constructs, then build in stages. After each stage you run the program and check the new code against its requirement, fix it before moving on, and check the earlier stages again. The solution is complete only when every requirement is met.
Key points
Worked example
Problem
A short program has two requirements. R1: ask for the user's age and show it. R2: show how old they will be next year. Build it in two stages, and show what checking after each stage catches.
⚠ Watch out
Moving on as soon as a new stage works, without checking the earlier stages again. New code can quietly stop an earlier requirement from being met.
Memory hook
Tiny step, run it, ask "is it RIGHT?", fix it, look BACK, tick it off.
Check yourself
Your new stage prints exactly what its requirement asks, and the program shows no error message. Is it safe to start the next stage straight away? Say what you still need to do, and why.
Flashcards
(11)What does it mean to program a solution to requirements?
What do you identify for each requirement before writing code?
Which programming constructs might a requirement need?
Why is a solution built in stages?
What happens at the end of each stage?
What is a logic error?
Is a stage that runs without a syntax error always correct?
Why is an error easier to find when you check after every stage?
When do you fix a stage that does not meet its requirement?
Why check the earlier stages again after adding a new stage?
What does the programmer keep track of?
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 Eduqas GCSE Computer Science topics
- File handling: write to a file
- Iteration: condition and counter controlled loops
- Lists, tuples and dictionaries
- Mathematical and logical operations in code
- Modular structuring with abstraction
- Presenting test outcomes with commentary
- Refining code during development
- Selection in programs
- Sequence in programs
- String manipulation in code
- Subroutines with well-defined interfaces
- Typical, extreme and erroneous test data
How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)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 16 November 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.