linspace() in Python

Syntax : numpy.linspace(start, stop, num = 50, endpoint = True, retstep = False, dtype = None)

Def : Returns number spaces evenly w.r.t interval. Similar to arange but instead of step it uses sample number.

Sample Program

import numpy as py

arr = py.linspace(1, 8, num=5, dtype=int, endpoint=False)

for items in arr:
    print(items)

for items in range(len(arr)):
    print(arr[items])

Leave a comment