parallel loops in python

Solutions on MaxInterview for parallel loops in python by the best coders in the world

showing results for - "parallel loops in python"
Laura
07 Jan 2018
1 pythonCopyfrom joblib import Parallel, delayed
2import math
3
4def sqrt_func(i, j):
5    time.sleep(1)
6    return math.sqrt(i**j)
7
8Parallel(n_jobs=2)(delayed(sqrt_func)(i, j) for i in range(5) for j in range(2))
9