I believe this is an issue with Python's integer division. When you divide an integer with another integer Python will return the nearest integer to the true value. To get a floating point value you must convert one of the values to a float. Try changing the code:
to:
Code:
(float(index)/intervals)