If your code doesn’t work that’s a good thing

I have been a Python teacher on Udemy since 2014, and I have received thousands of reviews from my students. I am happy to say that most of them are positive. The bad reviews are usually given by students who are frustrated whenever they run into a problem, aka a code error. If you also can’t stand coding errors, please keep reading because I will change your perspective on errors.

Here’s a typical review of a student who obviously gave up because he faced an error that hindered his learning path:

And here is a review from a student who enjoyed getting errors:

The lesson to take here is that no matter how good you are in programming, you are going to get many errors. That’s just how it works.

In fact, if your code doesn’t work, that’s a good thing. Doesn’t make much sense, does it? Well, it does for two good reasons:

  1. Getting errors earlier now while you are learning is better than later when you’re working in a production environment. That said, even in industry level it’s estimated there are 15-50 errors per 1000 lines of delivered code (Reference: “Code Complete: A practical Handbook of Software Construction, Second Edition” book).
  2. Every code error you experience when you are learning enforces you coding skills because you understand how the undergrounds of programming work. You don’t want everything to go smoothly. Driving a bumpy road will make you a better driver.

So, don’t get intimidated by programming errors. Instead, just follow these two simple steps when you get an error:

1. Read the error carefully. Error messages are very well-designed. They will tell you the exact line of code that has the problem and what type of problem there is. That will help you understand the problem and eventually fix it.

2. If you don’t understand the error, just copy the error and paste it on Google and you will find Stack Overflow posts that will tell you exactly how to fix that error.

And remember, persistence is crucial to solving these errors no matter how impossible they may look, you can do it!

Chill those errors out!

Recommended Course

Learn Flask development and learn to build cool apps with our premium Python course on Udemy.

Subscribe to be the first to know when a new Python course is released.