advanced-python-homework-2023/interpreters/test_funcs/linspace.py

8 lines
163 B
Python
Raw Normal View History

2023-10-06 13:14:14 +03:00
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