human
Can you provide a the Python program you requested given the following:
I am working on the file "Programming_Lab_I/Programming Lab Sheet 4.ipynb".
The first task is:
Exercise 3: Measure execution time
Can you write Python program for it?
assistant
#Here is the Python program you requested.

import time
from functools import wraps

def timeit(func):
    '''
    Decorator to time the execution time of a function
    '''
    @wraps(func)
    def timed(*args):
        start = time.perf_counter()
        result = func(*args)
        total = time.perf_counter() - start        
        return result, total        
    return timed

# Time the factorization function.
factorize_tests2 = [4,1001,1231,123259,198473094]
timed_factorize = timeit(factorize)
for num in factorize_tests2:
    print('{:15}   {}'.format(num, timed_factorize(num)[1]))

def multiply_polynoms(polyA, polyB):
    '''
    This fuction takes two lists as parameters which represent polynoms.
    It returns the product of those two polynomes.
    '''
    result = [0]*(len(polyA)+len(polyB)-1)
    for i in range(len(polyA)):
        for j in range(len(polyB)):
            result[i+j] += polyA[i]*polyB[j]    
    return result

#Time the multiply_polynoms function
timed_multiply_polynoms = timeit(multiply_polynoms)
x = []
y = []
for i in range(0,2001, 100):
    poly = i*[1]
    x.append(i)
    calls = []
    for i in range(5):
        calls.append(timed_multiply_polynoms(poly, poly)[1])
    y.append(sum(calls)/len(calls))

# Plot the mean execution time against the polynom length
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(x,y)
plt.plot(x, [0.0000002*x**2 for x in x],'--')