GCSE · Computer Science · Eduqas · Spec C500QS
Error diagnostics
Your program falls over. Read every line hunting for the problem, or let the environment tell you what is wrong and where?
Computer Science · Software development
Press Run and read what it tells you
This till program should print the cost of a small shop. Press Run, read what comes back, then choose how to repair the program. Run it again after each change.
- # Shop till
- price = 4
- quantity = 3
- discount = 2
- subtotal = price * quantity
- total = subtotal - discount
- print("Items:", quantity)
- print("Total cost:", totl)
- print("Thank you")
The messages and outputs are what Python 3.13 gives for this exact code. Other languages and environments word their messages differently.
Computer Science · Error diagnostics
Take the message apart
Sort each fragment of a message by the job it does for the programmer.
Still to sort
Tells you WHAT went wrong (0)
The kind or cause of the error.
Where the line is: If it names the kind of error or the cause, it is a 'what'. If it gives a place, it is not.
Tells you WHERE (0)
The place in the code, such as a line number.
Where the line is: If it points to a place in the code, it is a 'where'. If it only describes the problem, it is a 'what'.
Neither (0)
Sounds like a message, but gives you nothing to act on.
Where the line is: If you could not use it to find the error or choose a fix, it does neither job.
Every fragment below is doing a job. Which one?
Error diagnostics
Reason it through
Why does a diagnostic save a programmer time and effort?
First link · your turn
The environment finds an error in the code. What does the programmer get to see?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
The message that tells you what went wrong, and where.
What you need to know
- Error diagnostics are a tool in a software development environment, such as an IDE. They help you write and test code.
- When the environment finds an error in your code, it reports it with a message. That message is an error diagnostic.
- The message usually says what went wrong, giving the kind or cause of the error.
Have a goMaya's program stops and shows: NameError: name 'scroe' is not defined. She groans: 'That tells me nothing!' Is she right?
No. It names the kind of error (NameError) and the cause: the name 'scroe' is not defined.
A diagnostic usually describes what went wrong, so even a short message gives you the kind or cause of the error.
- It usually also says where: for example, the line number the error was found on.
- The 'where' lets you go straight to that place instead of searching the whole program.
Have a goYour program is 200 lines long. The message says the error was found on line 87. Where do you look first?
Line 87. You do not start at line 1.
The message points to where the error was found, so you go there instead of searching all 200 lines.
- The 'what' shows what needs correcting, so you can choose the right fix.
- Put together, what and where cut the time and effort needed to find and correct errors.
- A diagnostic reports the problem. It does not repair it: you decide on the fix and make it.
Have a goSam presses Run, reads a NameError message and cheers: 'Brilliant, it has fixed itself!' What has Sam missed?
The message only reports the error. Nothing has changed until Sam edits the code.
A diagnostic says what went wrong and where. Making the correction is still the programmer's job.
- You can use diagnostics while you are writing and testing code, not only at the end.
The big picture
Error diagnostics are messages from a software development environment that report errors found in your code. A message usually says what went wrong and where, so you can go straight to the place and know what to correct. That cuts the time and effort of finding and fixing errors.
Key points
Worked example
Problem
Your program stops with this message. Use it to find and fix the error. IndentationError: expected an indented block after 'for' statement on line 2 (reported at line 3) 1 names = ["Asha", "Ben", "Cai"] 2 for n in names: 3 print("Hi", n)
⚠ Watch out
Expecting the environment to repair the code, or ignoring the message and searching the whole program anyway. The message reports what went wrong and where. You choose and make the fix.
Memory hook
What + where = no wandering. The message points; you fix.
Check yourself
Imagine your environment only ever said 'Something went wrong.' Which two jobs would the message be missing, and what would you have to do instead?
Flashcards
(10)Where do error diagnostics come from?
What is an error diagnostic?
What does the 'what' half of a diagnostic give you?
What does the 'where' half of a diagnostic give you?
A program has 200 lines and one error. How does a diagnostic save you reading them all?
How does the description in a diagnostic help you fix an error?
Why do diagnostics save time and effort?
Does an error diagnostic fix your code for you?
When can a programmer use error diagnostics?
A message reads IndexError: list index out of range, line 9. Which part is the 'what' and which is the 'where'?
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
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 15 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.