def pySum(n): a = list(range(n)) b = list(range(0,3*n,3)) c = [] for i in range(len(a)): c.append(a[i]**2+b[i]**3) return c import numpy def nySum(n): a = numpy.arange(n) b = numpy.arange(0,3*n,3) c = a**2 + b**3 return c import datetime start = datetime.datetime.now() pySum(200000) delta = print(datetime.datetime.now()-start) start1 = datetime.datetime.now() nySum(200000) delta = print(datetime.datetime.now()-start1)