From the course: Programming Concepts for Python
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Catch errors - Python Tutorial
From the course: Programming Concepts for Python
Catch errors
- 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. Unfortunately, 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…