Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello, when i run timeit , its showing me that is not callable its giving error like this :-
Traceback (most recent call last):
  File "C:\Users\MAVERICK\Desktop\timeit.py", line 1, in <module>
    import timeit
  File "C:\Users\MAVERICK\Desktop\timeit.py", line 3, in <module>
    print(timeit.timeit('1+2' , number=100))
TypeError: 'module' object is not callable


PLEASE SOLVE IT ? I COULDNT SOLVE IT MYSELF ....

What I have tried:

import timeit

print(timeit.timeit('1+2' , number=100))
Posted
Updated 25-Jun-20 20:48pm

1 solution

Based on this: python - Getting "TypeError: 'module' is not callable" when calculating execution time with timeit - Stack Overflow[^]

You need to change the name of your file name. It can't be the same as 'timeit.py'. Use 'mytimeit.py' or something else.

For further details, please check out the documentation: timeit — Measure execution time of small code snippets — Python 3.8.3 documentation[^]
 
Share this answer
 
v2
Comments
CPallini 26-Jun-20 7:23am    
5.
Maciej Los 26-Jun-20 7:25am    
Thank you, Carlo.
PythonPreran 27-Jun-20 7:17am    
ThankYou Bro

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900