[Solved] Python Use timeit Error: stmt is neither a string nor callable.

Example :

print(timeit.timeit(cal_pi(100_0000),number=10000))

this error is occurring because of cal_pi function  have parameters

Modify to:

 print(timeit.timeit(lambda: cal_pi(100_0000),number=10000))

Ranjeet Singh Rawat
Ranjeet Singh Rawat

Leave a Reply

Your email address will not be published. Required fields are marked *