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.

Python
  1. x = 0
  2. whiel x < 5:
  3. print("Hello"
  4. 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?

Link 1 of 4

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?

2
Locked — reveal the link above first
3
Locked — reveal the link above first
4
Locked — reveal the link above first

What do you reckon?

What does a syntactical error actually do?

You have just typed a program that contains a syntactical error, and you press Run.

Which of these is closest to what you think happens next?
How sure are you?

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.

8 of 8 still to sort.

Commit to a category, then read why. One of the lines is perfectly fine.

Write it like you mean it

Explain the error in your own words

print("Welcome to the quiz)

Explain why this line contains a syntactical error, and write the corrected line. [3 marks]

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

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

1Syntax is the set of grammar rules for writing statements in a programming language: its keywords, punctuation and structure.
2A syntactical error is a mistake that breaks those rules.
3The translator can't recognise a statement that breaks the rules, so it can't translate it into machine code.
4A program with a syntactical error can't be translated and run until the error is corrected.
5A misspelt keyword and missing or unmatched punctuation are both syntactical errors.

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?
The grammar rules of a language: how statements must be written, including keywords, punctuation and structure.
What is a syntactical error?
A mistake in code that breaks the grammar rules (syntax) of the programming language it is written in.
Why can't the translator handle a line with a syntactical error?
It can't recognise a statement that breaks the language's rules, so it can't translate it into machine code.
When can a program with a syntactical error run?
Only after the error has been corrected. Until then it can't be translated and run.
Give an example of a syntactical error involving a keyword.
Misspelling a keyword, such as writing retrun instead of return. The translator can't recognise it as a valid statement.
Give an example of a syntactical error involving punctuation.
Missing or unmatched punctuation, such as a bracket that is opened and never closed.
How do you explain why a line has a syntactical error?
Identify the grammar rule the line breaks, for example that brackets must come in matching pairs.
True or false: the translator guesses what you meant and carries on.
False. It can't recognise a statement that breaks the rules, so nothing is translated or run until it is corrected.
Is a syntactical error the only kind of programming error?
No. It is one kind of programming error. Other kinds are covered in their own lessons.
What can the translator do with a statement that follows the language's rules?
Recognise it as a valid statement, so it can be translated into machine code.

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.