Skip to content
Justice Tech School

arange and linspace

arange steps by size and linspace gives a count of evenly spaced values.

Example
print(np.arange(0, 10, 3))
print(np.linspace(0, 1, 5))
print(np.arange(5, 0, -2))

Result

[0 3 6 9]
[0.   0.25 0.5  0.75 1.  ]
[5 3 1]

Exercise

Evenly spaced count.

np.(0, 1, 5)

Quiz Test

Does arange include the stop?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.