#https://gist.github.com/axelpale/3e780ebdde4d99cbb69ffe8b1eada92c def frange(x, y, jump=1.0): i = 0.0 x = float(x) # Prevent yielding integers. y = float(y) # Comparison converts y to float every time otherwise. x0 = x epsilon = jump / 2.0 yield x # yield always first value while x + epsilon < y: i += 1.0 x = x0 + i * jump yield x print(list(frange(0.0, 1.0, 0.1)))