>>> def f1(x):
... return 2 * x
...
>>> def f2(x):
... return x * x
...
>>> def g(func, start, end, step):
... while start <= end:
... yield start, func(start)
... start += step
...
>>> list(g(f1, -3, 3, 1))
[(-3, -6), (-2, -4), (-1, -2), (0, 0), (1, 2), (2, 4), (3, 6)]
>>>
>>> list(g(f2, 0, 10, 1))
[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25), (6, 36), (7, 49), (8, 64), (9, 81), (10, 100)]
>>>