When you try your best, but you dont succeed

--Originally published at Codebuster

In order to attack and avoid them, you need to know your enemy, in this case the types of errors that could avoid your program running. Errors are commonly divided in three categories:

  • Syntax errors:

A syntax error occurs in the structure of a program, so like grammatic rules in English. A computer can’t execute a program if it has one of this erors. If a program is syntatically wrong, Python will kindly let you know by returning an error message.

  • Runtime errors:

Another type of error is called runtime error, given that it only appears when you run the program. They usually mean something important has gone wrong.

  • Semantic errors:

Finally we have semantic errors. This are tricky ones, because the program will run without displaying an error message, but it won’t do what you meant it to. So basically you succesfully wrote a program, just not the one you needed.