GCSE · Computer Science · Eduqas · Spec C500QS
Syntactical errors
One wrong letter in your code and Run doesn't give a slightly wrong answer. It gives a refusal. Why won't it just work out what you meant?
Try it first
Press Run and see what happens
Press Run. Read what the translator says and which line it points at, then pick the fix for that line. Keep running until the program works.
Only syntax today: we are just asking whether the translator can read each line.
- x = 0
- whiel x < 5:
- print("Hello"
- x = x + 1
Messages checked against Python 3.13. Other versions may word a message slightly differently.
Why the program refused to run
Reason it through
Why can't a program with a syntactical error run?
First link · your turn
Start with the line the translator pointed at: a misspelt keyword, or a bracket that never closes. What has gone wrong with it?
Now you do the detective work
Which rule does each line break?
For each line of Python, choose the grammar rule it breaks. If it follows the rules, say so.
Still to sort
Misspelt keyword (0)
A word that should be a keyword isn't spelt the way the language needs.
Where the line is: The word is meant to be one of the language's own keywords. A made-up variable name isn't a keyword.
Missing or unmatched punctuation (0)
A bracket or quotation mark is left out, or doesn't have its partner.
Where the line is: The words are all fine, but a piece of punctuation is missing or has no partner.
Broken statement structure (0)
The statement isn't built the way the language requires.
Where the line is: The words and punctuation are present, but the statement is incomplete or put together the wrong way round.
Follows the rules (0)
Every keyword, piece of punctuation and part of the structure is as the language requires.
Where the line is: Nothing is misspelt, nothing is unmatched, and the statement is complete.
Commit to a category, then read why. One of the lines is perfectly fine.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Break one grammar rule and the program never gets to run.
What you need to know
- A syntactical (syntax) error is one kind of programming error.
- Every programming language has syntax: grammar rules for how its statements must be written, covering keywords, punctuation and structure.
- Break one of those rules and you've made a syntactical error.
- The translator can't recognise a statement that breaks the rules, so it can't turn it into machine code.
- Until the error is corrected, the program can't be translated, so it can't run.
Have a goSam is sure of it: "Only line 8 of my program is broken, so the rest is fine and my program will still run." Does that match what you've just read?
No. The program can't be translated and run until line 8 is corrected.
A syntactical error holds up the whole program, not just the line it sits on. It cannot be translated and run until the error is corrected.
- Misspelling a keyword counts: the translator can't recognise it as a valid statement.
Have a goA pupil writes esle: where the second branch of a Python decision should start. Which keyword did they mean, and why is the line refused?
They meant else. esle isn't a keyword, so the translator can't recognise the statement.
A misspelt keyword is not the keyword at all, so the translator has nothing valid to recognise.
- Missing or unmatched punctuation counts too, like a closing bracket that never arrives.
Have a goThis line is being refused: score = (4 + 5 * 2. What is missing, and what kind of mistake is that?
A closing bracket to match the opening one. It is missing punctuation, a syntactical error.
Missing or unmatched punctuation breaks the language's grammar rules, even when every number and symbol is right.
- To explain a syntactical error, identify the grammar rule that the line breaks.
The big picture
A syntactical error breaks the grammar rules of a programming language. The translator can't recognise the broken statement, so the program can't be translated or run until the error is corrected.
Key points
Worked example
Problem
Explain why this line of Python contains a syntactical error: if score >= 50 print("Pass")
⚠ Watch out
Thinking the translator will work out what you meant, or that a syntax error just makes the answer wrong. A syntactical error means the code can't be translated at all, so the program won't run until the line is corrected.
Memory hook
Rule broken, line not recognised, code not translated, program not run. Fix the line and it moves again.
Check yourself
Cover the page and explain to an imaginary friend what syntax is, what a syntactical error does to a program, and what you would write to explain why a line is wrong.
Flashcards
(10)What does syntax mean in programming?
What is a syntactical error?
Why can't the translator handle a line with a syntactical error?
When can a program with a syntactical error run?
Give an example of a syntactical error involving a keyword.
Give an example of a syntactical error involving punctuation.
How do you explain why a line has a syntactical error?
True or false: the translator guesses what you meant and carries on.
Is a syntactical error the only kind of programming error?
What can the translator do with a statement that follows the language's rules?
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 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.