import time def benchmark(): start = time.monotonic() #Calculs intensifs n = 1000000 sum = 0 for i in range(n): sum += i print(sum) end = time.monotonic() elapsed = end - start print("Temps d'exécution :", elapsed) benchmark()
Create, edit, and import your Python scripts
import time def benchmark(): start = time.monotonic() #Calculs intensifs n = 1000000 sum = 0 for i in range(n): sum += i print(sum) end = time.monotonic() elapsed = end - start print("Temps d'exécution :", elapsed) benchmark()