numpy.arange () in Python

About:
arange ([start,] stop [, step,] [, dtype]): returns an array with evenly spaced elements according to interval. The mentioned interval is half open, i.e. [Start, Stop)
Parameters :

  start:  [optional] start of interval range. By default start = 0  stop:  end of interval range  step:  [optional] step size of interval. By default step size = 1, For any output out, this is the distance between two adjacent values, out [i + 1] - out [i].  dtype:  type of output array 

Return :

 Array of evenly spaced values. Length of array being generated =  Ceil ((Stop - Start) / Step)  

# Python Programming Illustrative
# numpy.arange method

 

import numpy as geek

 

print ( "A" , geek.arange ( 4 ). reshape ( 2 , 2 ), "" )

 

print ( "A" , geek.arange ( 4 , 10 ), "" )

 

print ( "A" , geek.arange ( 4 , 20 , 3 ), "" )

Output:

 A [[0 1] [2 3]] A [4 5 6 7 8 9] A [4 7 10 13 16 19] 

Notes:
These NumPy-Python programs will not work by onlineID, so run them on your systems to examine them.

This article is courtesy of Mohit Gupta_OMG



Get Solution for free from DataCamp guru