Question: I'm trying to write a function in python that is like:

```
def repeated(f, n):
    ...

```

where `f` is a function that takes one argument and `n` is a positive integer.

For example if I defined square as:

```
def square(x):
    return x * x

```

and I called

```
repeated(square, 2)(3)

```

this would square 3, 2 times.

Answer: 
Something like this?

```
def repeat(f, n):
     if n==0:
             return (lambda x: x)
     return (lambda x: f (repeat(f, n-1)(x)))

```
I think you want function composition:

```
def compose(f, x, n):
  if n == 0:
    return x
  return compose(f, f(x), n - 1)

def square(x):
  return pow(x, 2)

y = compose(square, 3, 2)
print y

```