The script is preforming Integer Division, which in this case is 0 (well 0 r1).
The simplest method would be to make one or both of the numbers floating point numbers
value = 1.0/2
value = 1/2.0
value = 1.0/2.0
You could also cast one to a float, but it must be prior to the division operation.
value = float(1)/2 #yields 0.5
value = 1/float(2) #yields 0.5
value = float(1)/float(2) #yields 0.5
value = float(1/2) #yields 0
but that is ugggggly.
The advanced way is to import the future division operator:
from __future__ import division
value = 1/2 #yields 0.5
Note: with the future import you can still get the floored answer by using the //
operator
from __future__ import division
value = 1//2 #yields 0