import multiprocessing def square(x): return x**2 if __name__ == '__main__': pool = multiprocessing.Pool(processes=4) results = [] for i in range(10): result = pool.apply_async(square, (i,)) results.append(result) for result in results: print(result.get())In the above example, we define a function `square` that squares a given number. We initialize a process pool with 4 workers and then loop over 10 numbers, submitting each one to the pool. We store the result of each task in a list, and then loop over the list and call the `get()` method to retrieve the results. This will block until each result is ready. The package library used is `multiprocessing`.