Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Created April 12, 2021 18:08
Show Gist options
  • Save MohamedElashri/7697126a710c6b91ac6a1301a3d45b77 to your computer and use it in GitHub Desktop.
Save MohamedElashri/7697126a710c6b91ac6a1301a3d45b77 to your computer and use it in GitHub Desktop.
How long python script takes to execute ? #python
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