makming an np array of 1 to 10 python code example
Example 1: create an array from 1 to n python
a_list = list(range(1, 5))
print(a_list)
[1,2,3,4,5]
Example 2: np.arange in python
>>> 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])