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.

Python
  1. # Stage 1: ask how many tickets are wanted
  2. tickets = int(input("How many tickets? "))
  3. # Stage 2: work out the cost, then show it
  4. cost = tickets * 8
  5. # Stage 3: £10 off for 5 or more tickets
  6. if tickets > 5:
  7. cost = cost - 10
  8. 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 · What you might think

Which of these sounds like you?

You have just added a few lines to your program and pressed Run. Nothing crashed and no error message appeared. Three people give their advice.

Which is closest to what you think right now?
How sure are you?

Exam line: Say what the output should be, then compare it with what the stage actually did.

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.

6 of 6 still to sort.

Exam line: For each requirement, identify the inputs, processing and outputs the program needs to meet it.
Watch out: A check such as "is it 5 or more?" is processing, not input. Nobody typed it in.

Computer Science · Choosing constructs

Which constructs does each requirement need?

Tick the constructs each ticket-booth requirement needs. Every requirement also uses variables and sequence, so those are not columns.

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, take £10 off the cost
R4: print a numbered ticket for each ticket bought

Exam line: Choose the programming constructs each requirement needs, one requirement at a time.

Computer Science · The development loop

The loop you repeat for every requirement

3 stages are missing. Use the rest of the loop to work out which goes where.

  1. Stage 1: Write a small stage

    Code for one requirement, added to the program that already works.

  2. Stage 3: Check it against the requirement

    Does the output or behaviour match what that requirement asks?

  3. Stage 4: Fix what is wrong

    Find the error in the new code, correct it, then run and check again.

…and stage 6 leads back to stage 1.

Exam line: Run, check against the requirement, fix before moving on, re-check earlier stages, and track which requirements are met.

Computer Science · Your turn

Describe the method for a brand-new requirement set

A school wants a program with three requirements. R1: ask for a pupil's test mark out of 20. R2: if the mark is 12 or more, display "Pass", otherwise display "Try again". R3: do this for five pupils, one after another. Describe how a programmer should develop a program that meets these requirements. [7 marks]

0 words · your answer stays on this page and is not sent anywhere.

Exam line: Cover each part of the method: identify, choose constructs, build in stages, run and check, fix, re-check, track.

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

1Build in stages: one requirement, run it, check it against that requirement, then add the next.
2Runs without a syntax error does not mean correct: output or behaviour must match the requirement, or it is a logic error.
3Fix a failing stage before moving on; small additions make the error easier to locate.
4After each new stage, check the earlier stages again, and finish only when every requirement is met.

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?
Write a program whose behaviour satisfies every one of the requirements it has been given.
What do you identify for each requirement before writing code?
The inputs, processing and outputs the program needs in order to meet it.
Which programming constructs might a requirement need?
Constructs such as variables, input and output, sequence, selection (if statements) and iteration (loops), chosen for each requirement.
Why is a solution built in stages?
A small part that meets one requirement is made to work first, and code for the next requirement is then added to it.
What happens at the end of each stage?
The program is run and the code just written is checked to confirm it does what that requirement asks, before the next stage starts.
What is a logic error?
A fault where the stage runs but its output or behaviour does not match what the requirement asks.
Is a stage that runs without a syntax error always correct?
No. It is only correct if its output or behaviour matches the requirement.
Why is an error easier to find when you check after every stage?
Only a small amount of new code was added since the last check, so there are few places for it to hide.
When do you fix a stage that does not meet its requirement?
Straight away, before moving on to the next stage.
Why check the earlier stages again after adding a new stage?
To confirm that the requirements those earlier stages met are still met.
What does the programmer keep track of?
Which requirements have been met.

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 posted

More Eduqas GCSE Computer Science topics

See the full Eduqas Computer Science curriculum →

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.