Add Python3 support

Replaced prints and divisions.