From the course: Programming Foundations: Real-World Examples

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Error catching

Error catching - Python Tutorial

From the course: Programming Foundations: Real-World Examples

Start my 1-month free trial

Error catching

- No matter how good of a programmer you are, you will have errors in your code, and there are two main types of errors that you'll encounter, syntax errors and runtime exceptions. Syntax, or parsing, errors are usually the first type of problem you run into, and those are the little typos and other mistakes that make your code invalid so that it can't even be run. And fortunately, those are pretty easy to handle. Most development tools will instantly detect syntax errors in your code, and they'll let you know where there's a problem so you can go fix it. Once you have a valid program, the next worry are exceptions, and these are the problems that occur when your program is running, and it tries to do something illegal, like divide by zero. Numerous issues can cause these exceptions, so it's important to incorporate error handling into your code to detect when these problems occur. And in many cases, the program can take some sort of action to recover from the error. I've made a lot…

Contents