perf_counter

 avatar
unknown
plain_text
3 years ago
256 B
4
Indexable
##Measuring performance of code

import time

def sum_up_to(n):
    sum = 0

    for number in range(1, n + 1):
            sum = sum + number

    return sum

start = time.perf_counter()
print(sum_up_to(125555))
end = time.perf_counter()
print(end-start)
Editor is loading...