Pure Programmer
Blue Matrix


Cluster Map

Project: CurrentTimeMilliseconds

Often it is necessary to time how long a section of code takes to execute to get useful information for optimization. Write a program that computes squares between 1 and 10,000 and prints them. Time how long it takes to perform this function to milliseconds resolution.

Output
$ python CurrentTimeMilliseconds.py 1^2 = 1 2^2 = 4 3^2 = 9 4^2 = 16 5^2 = 25 6^2 = 36 7^2 = 49 8^2 = 64 9^2 = 81 10^2 = 100 ... 9991^2 = 99820081 9992^2 = 99840064 9993^2 = 99860049 9994^2 = 99880036 9995^2 = 99900025 9996^2 = 99920016 9997^2 = 99940009 9998^2 = 99960004 9999^2 = 99980001 Duration: 6 ms

Solution