While I personally have a favorite Python editor, I’ll try to go through several editors. I believe that someone out there should start packing Python with a better default editor as it makes coding in Python much more difficult than it should be.

At the bare minimum, you should be using Notepad++ over the default Python editor. You will still need to find a way to execute the script, but at least it has some intellisense about the language. In case you do not know what intellisense is, it is basically an aid that when you are typing code, it suggests functions, classes, etc while you are typing.


My personal favorite is… PyCharm! I am actually quite a fan of several JetBrains products. One benefit of using PyCharm is that it is based on a set of shortcut standards for several of their products. When you move into Java or .Net, they have editors for both (well, .NET is more like a plugin called “Resharper”). Another perk of PyCharm is that you can debug in the editor. Once you get some scripts running and start your journey into OOP (object oriented programming), try to dig into PyCharm’s shortcuts and use them as much as you can. The biggest downside to PyCharm is that if you want to maintain a Django project, you must buy the professional edition. To learn more about PyCharm and how to make coding in Python more fun, take some time and study this book.


I won’t go into as much detail on the other editors as my experience with them is far less than with PyCharm. However, I do like PyDev because you can install it on Eclipse. If you haven’t played with Eclipse much, it’s almost like a more advanced universal editor where you can install various plugins for different languages. Obviously, this is beneficial because you only need to open one editor to work on any type of project. Anyway, PyDev has many of the great features that PyCharm has including debugging, intellisense, and more. Although, I still consider PyCharm to be the much better experience, PyDev allows Django development for free!

Other Python Editors

PyCharm and PyDev, in my opinion, are the top two editors for Python and Django. In third place, WingIDE is really powerful, but it just seems like a very old and quirky editor. Perhaps I’m shallow, but I like my editors to look as great as they feel to use.

As for other editors, I won’t recommend them as I haven’t found any that compete with those three. Nevertheless, the important thing about picking an editor is to make sure it feels good to you. You want an editor than makes coding both fun and productive. Have fun shopping for your new Python editor!


Now that you have studied some object oriented programming and know a good deal of Python, we should look to how you can apply this knowledge to web programming. Previously, we discussed that you could use Python to simply print the html that you wanted. Printing out your entire webpage with Python is horrendous and difficult to maintain. Sure, you might come up with some clever ways to make it more manageable, but I have a far better solution for you.

Django is an excellent web framework for Python that forces your code to be more easily maintained and has a few other perks. It helps keep your code more maintainable by separating your Python code from your html by using an MVC (model, view, and controller) pattern. Once you follow their tutorials, you’ll start to understand how to separate your code into this pattern. I should mention that your typical MVC views are called templates and your typical MVC controllers are called view, which I find very confusing. But, that’s the majority of my complaints with all of Django.

To be fair, learning Django isn’t very easy and it has several more advanced concepts like ORM (Object-relational mapping) and it is also not the easiest thing to get running. However, as you fight your way through learning these, you will realize that they are pretty common in most other web languages. C# has entity framework, Java and ColdFusion use Hibernate, so you will eventually run into ORM. Essentially, ORM is like using your programming language to interact with a database instead of using SQL.

Anyway, please take some time and go build a website with Django. It will help you understand a fundamental paradigm of web development, MVC, and other important advanced web development concepts. Go forth and learn!

As I’ve said, Django is pretty difficult to learn if you are new to programming. I’d highly recommend getting a book to help you work through it, like the one below.

Python Quiz

The Standard Python Quiz

It’s Python quiz time. You have finally finished our current tutorials for Python. No worries, more tutorials are still being developed, but for now, we have to rest. I would first like to congratulate you on working through those tutorials. Your dedication to learning a new language like Python is impressive, but you might be wondering exactly what you learned or how well you paid attention. That is precisely why we have crafted a quiz. The questions that compose this quiz are designed to test if you understand the basics of Python, but it will not quiz advanced topics. However, this quiz is probably the beginning of a series of quizzes for each tutorial category.

Start the Python Quiz

Python Tests and Exams

Currently, we only have a standard quiz that is not intended to be a professional test. There is a possibility to integrate a testing system into After Hours Programming, but we are not actively working towards that goal at the moment. For now, we have created a simple quiz to check your understanding of Python. Good luck and I hope you enjoyed our Python tutorial. Please contact us if you would like more Python tutorials.


In any programming, including Python, exceptions and error handling often becomes a necessity when you are dealing with a considerable amount of variables. When, I say variables I do not mean variables as a placeholder, but variables as in you are using file system processes (like reading a file), dealing with external input, etc. Sometimes, you just do not know what will be thrown at your code. So you being little genius, you plan ahead and use exceptions and error handling where appropriate. Typically, the goal is to execute the code as intended, but if an exception occurs, we would prefer Python not to spit out its own exceptions. Instead, we would like to inform the user what went wrong using our wording and possibly how they can maneuver around the obstacle.

Exceptions vs Errors

I know I keep babbling about exceptions and errors, but what in the heck are they and how are they different you might ask. Well, exceptions generally deal with small little issues that you would probably like to handle. For example, maybe you do not exactly know the type of the variable, but you would definitely like to do something with it. The differences in doing things with numbers and strings are pretty different. So, you might set up something like this:

var1 = '1'
    var1 = var1 + 1 # since var1 is a string, it cannot be added to the number 1
    print(var1, " is not a number") #so we execute this

Awesome! We totally caught the exception that python gave us. We simply put the code we wanted to execute under the try block. However, if an exception occurred (adding a string to and integer is an exception) we told Python to do everything in the except block.

So, what are errors? Bad news, that’s what they are. You normally do not want to handle errors, unless you are doing some dangerous things. When an error is generated, it typically means Python is blowing up the ship, Obviously, if the ship is blown up, we should jump ship and get out of the program.

Also, you might have noticed that the print() takes two arguments in this example. Well, it can take as many arguments as you want to give it. print() will keep on printing all of your arguments with a space in between them.

Elegant Error Handling

Let’s face it our try/except above, doesn’t do a whole lot for the usability of the program. Basically, if it messes up it just tells our users what is wrong. What is the point in that? We should attempt to handle our exceptions in a manner that helps the program to keep moving on. A better alternative would be something like this:

var1 = '1'
    var2 = var1 + 1 # since var1 is a string, it cannot be added to the number 1
    var2 = int(var1) + 1

Ah, much better. In this example, we use our simple except to catch an exception. But, if you run the example, you will see something much more awesome happening. We actually catch the exception, and tell python, “Well, try casting it to an integer before adding”, where Python faithfully obeys. As the end result, Python prints out the number 2 and the user is none the wiser that the program had a small hiccup.


The Python tutorial is constructed to teach you the fundamentals of the Python programming language. Eventually, the Python Tutorial will explain how to construct web applications, but currently, you will learn the basics of Python offline. Python can work on the Server Side (on the server hosting the website) or on your computer.

However, Python is not strictly a web programming language. That is to say, a lot of Python programs are never intended to be used online. In this Python tutorial, we will just cover the fundamentals of Python and not the distinction of the two.

Python works much like the two previous categories, PHP and ColdFusion as they are all server side programming languages. You will see from the Python tutorials that it’s syntax is extremely different than the other two. It is probably the most clean and straightforward language you will ever learn.

Just like the other languages, Python is useful because it can dynamically generate content to provide a more customized user experience. Generally, Python is a great starting language for most people, but to others, it is extremely frustrating (primarily due to spacing issues), which is why I have put the Python Tutorial at the end of the server side languages.

Enough chatter!

We want to learn Python!