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.
Multiprocessing pool
Parallel processing of numerical data using map
Report a typo
Sample Input 1:
1 2 3 4 5
4Sample Output 1:
1 2 6 24 120Write 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
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.