+ 1
How to measure the execution time of this code snippet?
def sumOfN(n): return (n*(n+1))/2
2 Réponses
+ 2
you can mesure the time execution with using in first line: "start=time.time()"
and the final line: "print(time.time()-start)" and it will give you the time ,
0
there's no way to "measure" code execution in milliseconds per se, but if you used big O notation, this code has a time of O(1)