Is there a way to step between 0 and 1 by 0.1?
I thought I could do it like the following, but it failed:
for i in range(0, 1, 0.1): print i
more_itertools is a third-party library that implements a numeric_range tool:
import more_itertools as mit for x in mit.numeric_range(0, 1, 0.1): print("{:.1f}".format(x))
Output
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
This tool also works for Decimal and Fraction.