info & requirements:
- Two lists are given, a list of variables and a list of functions, no function requires more parameters then there are variables in the variable list.
- All possible combinations of input variables must be found for every function in the functions list. that means from 0 ->
len(variables)
- There is no guarantee that the function will accept the parameters.
- No edits can be made in the functions in the functions list, they can only be called.
When trying to solve this myself I found a solution that could handle functions with 2 parameters, but I don't know how to make it dynamic so it can scale to infinite parameters
# test input list
# functions = [test_method1, test_method2]
# variables = [1, 2, 3, 4, 5]
for f in functions:
for v in variables: # loop all conditions
try: # checks if combination throws error
f(v)
except TypeError as a: # if amount of parameters is > 1
for v2 in variables: # loop all conditions
try: # tries combination
f(v, v2)
except TypeError as e:
The above-shown code is not part of the solution, it's just my best try and is just for inspiration.
The result should be that all functions have tried to run with all possible combination of variables as parameters.