np.arrange 1

np.arrange

# numpy.arange([start, ]stop, [step, ]dtype=None, *, like=None)
import numpy as np

>>> np.arange(3)
array([0, 1, 2])
>>> np.arange(3.0)
array([ 0.,  1.,  2.])
>>> np.arange(3,7)
array([3, 4, 5, 6])
>>> np.arange(3,7,2)
array([3, 5])

Here is what the above code is Doing:
1. np.arange(3)
– This creates an array of numbers from 0 to 2.
2. np.arange(3.0)
– This creates an array of numbers from 0 to 2.0.
3. np.arange(3,7)
– This creates an array of numbers from 3 to 6.
4. np.arange(3,7,2)
– This creates an array of numbers from 3 to 5.

Similar Posts