I have to create a function mega_calculator, that takes in two inputs: a function and the number of times, I should repeat it. The function should return a value when I call it. inside the parent function(mega_calculator), now I have to create a second function that takes in the same number of inputs as the parent function mega_calculator by giving it parameters *args when I create it. My question is, how do I access the parent function parameters inside the second function?
I thought that *args was a list of parameters and therefore if I called the first and second values, I could save the function operation and repeat amounts onto variables, to later use inside the second function, but this did not work.
What should I do for that?, any help is loved and appreciated greatly. we must have the weird function setup, so unfortunately I can't just make a nice simple while loop.
def mega_calculator(fn, repeat = 1000):
def helper(*args):
function = *args[0]
bob = *args[1]
while bob > 0:
total += function
return (total/repeat)
return helper()
`