Created
April 12, 2021 18:08
-
-
Save MohamedElashri/7697126a710c6b91ac6a1301a3d45b77 to your computer and use it in GitHub Desktop.
How long python script takes to execute ? #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
code_to_test = """ | |
a = range(100000) | |
b = [] | |
for i in a: | |
b.append(i*2) | |
""" | |
elapsed_time = timeit.timeit(code_to_test, number=100)/100 | |
print(elapsed_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment