numpy.arrange()

It creates an array by using the evenly spaced values over the given interval. The interval mentioned is half opened i.e. [Start, Stop]).

Syntax

Parameters

It accepts the following parameters.

  1. start: The starting of an interval. The default is 0.
  2. stop: represents the value at which the interval ends excluding this value.
  3. step: The number by which the interval values change.
  4. dtype: the data type of the numpy array items.

Return

An array within the specified range is returned.

Example 1

Output:

[0. 2. 4. 6. 8.]

Example 2

Output:

The array over the given range is  [10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95]

Next Topicnumpy.asarray()




Latest Courses