how to create equally spaced numbers between 2 given points

211 Views Asked by At

how can i create a number of values between 1000 and 1500 with each value having a difference of 0.0299

3

There are 3 best solutions below

0
Jock On

The best way is to use the numpy library:

import numpy as np
your_range = np.arange(1000, 1500, 0.0299)
2
LiiVion On

You need to use floats to achieve this. Try this:

i = 1000
while i >= 1000.00 and i <= 1500.00:
    i += 0.0299
    print(i)
0
Still a learner On
l = list(range(1000*10000, 1500*10000, int(0.0299*10000)))
l = [i/10000 for i in l]

print(l[0:10])
#[1000.0, 1000.0299, 1000.0598, 1000.0897, 1000.1196,.........