Q:

Using lambda to call a function n number of times (python)

Can someone walk me through, if possible, how I would use the lambda function in Python to call a function n number of times?
Like I have a function 
def repeat_lam(a, n):
    lambda x: f(x)

I want to run a, n times on x. I'm not sure how to edit my current code to make it do this.
So if i had a function that was defined to multiply by 2 called mul_2.
repeat_lam(mul_2,3)(10)
80

A:

So our specification is:
>>> repeat_lam(mul_2,3)(10)
80

This setup requires that mul_2 is a function, which we can define using a lambda if we want. I will show that, but it isn't really needed. The implementation of repeat_lam will have nothing to do with lambdas. It will, however, need to be a function... that returns a function (so that we can call the result with (10).
def repeat_lam(func, times):
    def wrapper(arg):
        for i in range(times):
            arg = func(arg)
        return arg
    return wrapper

We define a function that is nested inside repeat_lam - in Python, functions are objects, so they can be treated like any other object. That means, among other things, that we can return it :) So what happens here is that wrapper refers to the func and times values that were passed in to repeat_lam. To support this, Python will return a separate object each time repeat_lam is called - each one will be a function, and each one will be "named" wrapper, but they get separate func and times values bound to them, through some internal Python magic (in technical terms, Python creates a closure). 
So when you call the returned function, it will automatically use the func and times values that were passed in when repeat_lam was called, along with the arg passed in for the call. The rest of that code is straightforward: we apply func repeatedly to arg, assigning back to arg to build up the results, and then we return it.
And now we can test it (and see how lambda is used):
>>> mul_2 = lambda x: x * 2
>>> repeat_lam(mul_2,3)(10)
80

The effect of the lambda is the same as:
>>> def mul_2(x):
...     return x * 2

but lambdas can only evaluate a single expression, so they are more limited in scope than full-fledged functions. The main purpose for them is when the task is so simple that you don't even want to bother naming it:
>>> repeat_lam(lambda x: x * 2, 3)(10)
80

A:

The simple, straightforward approach:
def exec_num_times(f,times,*args,**kwargs):
  for _ in range(times):
      f(*args,**kwargs)

There are other ways too. For example if you have a function, and then a list of arguments:
results = [f(x) for x in list_of_args]
However, that is not necessary as you can simply pass list_of_args directly to f(); as Python methods take variable list of arguments and you should not normally rely on a method being passed a particular type of variable. It should be flexible enough to work with any type.

