Python Algorithms

1.To test the time we used while execting something, we can issue the following command:

1
python -m timeit -s"import mymodule as m" "m.myfunction()"

or separately:

1
2
3
import timeit
timeit.timeit("x = 2 + 2")