from __future__ import division

Division behaviour gets corrected in Python3.0. So, for best compatibility, import division from future and turn // into /.