import time

def powers(limit):
  return [x**2 for x in range(limit)]

# Decorator Function (HOF)
def measure_runtime(func):
  start = time.time()
  func()
  end = time.time()
  print(end - start)

#measure_runtime(lambda : powers(500000))

"""
timeit
- Average accross many iterations 
"""
import timeit

print(timeit.timeit("[x**2 for x in range(10)]"))
print(timeit.timeit("list(map(lambda x: x**2, range(10)))")) 
a7b68497561ac3d54bd455b2e55a0ba92832f65c
<mask token>


def measure_runtime(func):
    start = time.time()
    func()
    end = time.time()
    print(end - start)


<mask token>

<mask token>


def powers(limit):
    return [(x ** 2) for x in range(limit)]


def measure_runtime(func):
    start = time.time()
    func()
    end = time.time()
    print(end - start)


<mask token>

<mask token>


def powers(limit):
    return [(x ** 2) for x in range(limit)]


def measure_runtime(func):
    start = time.time()
    func()
    end = time.time()
    print(end - start)


<mask token>
print(timeit.timeit('[x**2 for x in range(10)]'))
print(timeit.timeit('list(map(lambda x: x**2, range(10)))'))

import time


def powers(limit):
    return [(x ** 2) for x in range(limit)]


def measure_runtime(func):
    start = time.time()
    func()
    end = time.time()
    print(end - start)


<mask token>
import timeit
print(timeit.timeit('[x**2 for x in range(10)]'))
print(timeit.timeit('list(map(lambda x: x**2, range(10)))'))

import time

def powers(limit):
  return [x**2 for x in range(limit)]

# Decorator Function (HOF)
def measure_runtime(func):
  start = time.time()
  func()
  end = time.time()
  print(end - start)

#measure_runtime(lambda : powers(500000))

"""
timeit
- Average accross many iterations 
"""
import timeit

print(timeit.timeit("[x**2 for x in range(10)]"))
print(timeit.timeit("list(map(lambda x: x**2, range(10)))")) 