8 lines
163 B
Python
8 lines
163 B
Python
def linspace(start, stop, n):
|
|
if n == 1:
|
|
yield stop
|
|
return
|
|
h = (stop - start) / (n - 1)
|
|
for i in range(n):
|
|
yield start + h * i
|