Rewrite to python3

checking for 0 input