advanced-python-homework-2023/interpreters/linspace.py
2023-10-06 13:14:14 +03:00

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