" /> " /> "/>

How to pass multiple arguments to function in function in Python?

62 views Asked by At

I have a function in first Python file to do some manipulation with two strings:

J = "aA"
S = "aAAbbbb"

def numJewelsInStones(self, J: str, S: str) -> int:
    return len(J + S)

And function in another file to check time taken (performance test for small expressions):

def check_time(function, *args):
    print(timeit.timeit(lambda: function(args)))

So on startap i get error in print(timeit.timeit(lambda: function(args))):

rating.check_time(solution.numJewelsInStones, J, S)
TypeError: numJewelsInStones() missing 1 required positional argument: 'S'

How can i pass multiple arguments to inner function?

0

There are 0 answers