# Python numpy.linspace()

In this tutorial, I’ll talk about python numpy linspace() function. It is similar to arange() function, but it uses number of samples instead of step size. It creates evenly spaced numbers array over a specified interval.

### Syntax:

The syntax of python numpy linspace() function is

### Parameter:

numpy linspace() function can take 7 parameters

• start: starting value from where the array will start, by default it is zero
• stop: It represent the number , to stop the array upto this number.
• num(optional): It is a number value, which defines the number of samples you want to create. By default, it is 50.
• endpoint(optional): if endpoint will be True the stop number also will be, included in the array. By default, its true
• retstep(optional): If retstep is True, it returns the gap value between two steps. by default its False.
• dtype(optional): It is type of the items of output array, by default , it’s none.
• axis(optional): axis is integer value, it is in the result to store the sample. By default, its zero(0)

Check the examples below to understand

#### Example #1

creating an array between 5 to 10 using numpy linspace() function

#### Example #2

creating a three values array between 5 to 10 using numpy linspace()

#### Example #3

creating a four values array between 5 to 10 using numpy linspace().  In this array stop number  will not be include. I mean, 10 will not be include, because endpoint is False

#### Example #4

creating a three values array between 5 to 10 using numpy linspace(), It will also return the gap between two steps, because retstep is True.

Start with Numpy

Python Numpy.arange()