Lingua-e
Python + JavaScript

What is a SyntaxError?

← Errors

A SyntaxError means the interpreter or compiler cannot parse your code because it violates the grammar rules of the language. The code is not written in a way the language understands, so it cannot even start running.

Why it happens

  • Missing colon at the end of a def, if, for, or while statement (Python).
  • Missing or mismatched parentheses, brackets, or braces.
  • Using a reserved keyword as a variable name.
  • Forgetting a comma between arguments or items in a list.

Examples

Python

Code that triggers the error

def greet(name)
    print("Hello", name)

Error output

  File "app.py", line 1
    def greet(name)
                   ^
SyntaxError: expected ':'

How to fix it

Read the error message: it points to the line and character where the parser got confused. The actual mistake is often one line above. Use an editor with syntax highlighting and linting to catch these issues before running.

Fixed code

def greet(name):
    print("Hello", name)

greet("Alice")  # Hello Alice
JavaScript

Code that triggers the error

function greet(name) {
  console.log("Hello" name);
}

Error output

SyntaxError: Unexpected identifier 'name'

How to fix it

Read the error message: it points to the line and character where the parser got confused. The actual mistake is often one line above. Use an editor with syntax highlighting and linting to catch these issues before running.

Fixed code

function greet(name) {
  console.log("Hello", name);
}

greet("Alice");  // Hello Alice

Related errors

Ready to practice your English at work?

Lingua-e has interactive exercises built around real developer conversations: standups, code reviews, retrospectives, and more. Practice until it comes naturally.

Try Lingua-e for free