np.arange doesn’t include maximum value

Hello.

I have been using np.arrange for a long time but only now I have noticed that this built-in function doesn’t include the last maximum value. Like for example:


step = 2
print(np.arange(0, 26, step))

results in [0 2 4 6 8 10 12 14 16 18 20 22 24]

So how do we make sure we have the last (26) value included into our list. I found a pretty simple solution on the web:


step = 2
print(np.arange(0, 26+step, 2))

So if we add our 'step' to 'stop' parameter inside np.arrange function, it will generate use one more result on top and include the maximum possible output.