arange() in Numpy Python by R4R Team

- arange() is a python Numpy method which create a array in between the particular range.

Syntax-

numpy.arange(start,end,gap)

-Here start is starting number of the array
-and end is ending number of the array
-gap is the difference between the numbers of the array

Example-

arange(2,6,1) will return [2 3 4 5]
arange(2,7,2) will return [2 4 6]
arange(1,6,3) will return [1 4]


program-

#import numpy
import numpy as np

print("Array is ")
print(np.arange(2,8,1))

print("nArray is ")
print(np.arange(2,10,2))

print("nArray is ")
print(np.arange(3,6))


output-

Array is
[2 3 4 5 6 7]

Array is
[2 4 6 8]

Array is
[3 4 5]




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!