Parallel processing of numerical data using map

Report a typo

You are provided with a list of numerical data. Your task is to write a Python program that calculates the factorial of each number in the list using the map method of the Pool class for parallel processing.

Sample Input 1:

1 2 3 4 5
4

Sample Output 1:

1 2 6 24 120
Write a program in Python 3
from multiprocessing import Pool
import math

def parallel_factorial(numbers, num_processes):
# Your code here

if __name__ == "__main__":
numbers = list(map(int, input().split()))
num_processes = int(input())
result = parallel_factorial(numbers, num_processes)
print(*result)

Create a free account to access the full topic