The error says that you have not transferred enough arguments to the function, iterate over two elements and specify the indices for all arguments exactly:
def f(x, y): return x+y for f, args in ((f, (1, 2)), (f, (3, 5))): print(f(args[0], args[1])) # 3 # 8
You can also use unpacking - in python * . The key advantage that gives * is the ability to decompress sequences of unknown length. Suppose in your task functions take different sets of arguments:
def f(x, y): return x + y def fb(x, y, z): return x + y + z def fbt(a, b, c, x, y, z): return a + b + c + x + y + z j = ((f, (1, 2)), (fb, (1, 2, 3)), (fbt, (1, 2, 3, 4, 5, 6))) for func, args in j: print(func, args) print(func(*args)) # <function f at 0x7fef6fe41bf8> 1 2 # 3 # <function fb at 0x7fef6fe41c80> 1 2 3 # 6 # <function fbt at 0x7fef6fe41d08> 1 2 3 4 5 6 # 21
If the arguments are not formed in a tuple, then the following syntax can be used:
k = ((f, 1, 2), (fb, 1, 2, 3), (fbt, 1, 2, 3, 4, 5, 6)) for func, *args in k: print(func, *args) print(func(*args))