So I must make the following function -> iterate. On first call it should return identity, on second func, on third func.func. Any idea how to do it? I tried looking at the iter and next method buf failed: (
>>> def double(x):
return 2 * x
>>> i = iterate(double)
>>> f = next(i)
>>> f(3)
3
>>> f = next(i)
>>> f(3)
6
>>> f = next(i)
>>> f(3)
12
>>> f = next(i)
>>> f(3)
24