Three kinds of error
Every programmer writes broken code, every day. The skill is not avoiding errors but recognising which kind you have, because each kind is found a different way:
| Kind | When it shows up | What you see | Example |
|---|---|---|---|
| Syntax error | Before anything runs | Python refuses to start, points at the line | Missing : after if |
| Runtime error (exception) | While running, at the bad line | A traceback, then the program stops | Dividing by zero |
| Logic error | Never, on its own | Wrong output, no message at all | Checking >= 50 before >= 90 |
Syntax errors are the easiest: Python finds them for you, before a single line runs. Runtime errors come with a detailed report of where they happened. Logic errors are the hardest, because the computer did exactly what you wrote and has nothing to complain about. Only comparing actual output with expected output reveals them.
Key idea: An error message is Python telling you precisely what it could not do and where. It is the most useful text on your screen, not an obstacle.

