Put the following code at the very top of your scripts or division will not work as most humans expect. Code: from __future__ import division See https://www.python.org/dev/peps/pep-0238/ for more info. Maybe this should be stickied?