Say I want to loop from 0 to 100 but with a step of 1/2. If you try
for i in range(0, 100, 0.5): whatever
Python2.x:
for idx in range(0, int(100 / 0.5)): print 0.5 * idx
outputs:
0.0 0.5 1.0 1.5 .. 99.0 99.5
0.0
0.5
1.0
1.5
..
99.0
99.5
Numpy:
numpy.arange would also do the trick.
numpy.arange(0, 100, 0.5)