1import time
2
3# Calculate the power of two for a defined range of number
4def power_two(my_range):
5 return [x**2 for x in range(my_range)]
6
7# Measure time
8def measure_time(func):
9 start = time.time()
10 func() # any specific function to measure
11 end = time.time()
12 print(end - start)
13
14measure_time(lambda: power_two(10000000)) # lambda permits to pass the argument of our function