#/usr/bin/python3
from multiprocessing import Pool
import time

def f(a):
    x, y = a
    print("running on ", str(x), " and ", str(y))
    time.sleep(3)
    return [x, [[1, x*x], [2, 2*x*x], [3, 3*x*x]]]

def procresult(y):
    print("result is ", y)
    for x in y:
        print("loop is ", x)
        print("processing on ", x[0], "returned array: ")
        res = x[1:][0]
        print("res is ", res)
        for i in res:
            print("Loop ", i[0], " resulted in ", i[1])

if __name__ == '__main__':
    with Pool(2) as p:
        procresult(p.map(f, [(1, range(10)), (2, range(20)), (3, range(30))]))

