Parallel word length calculation using apply method

Report a typo

You have been provided with a list of words. Your task is to write a Python program to compute the length of each word using the apply method of the Pool class for parallel processing.

Sample Input 1:

fast efficient streaming

Sample Output 1:

4 9 9
Write a program in Python 3
from multiprocessing import Pool

def parallel_word_length(words, num_processes):
# Your code here


words = input().split()
num_processes = 4

result = parallel_word_length(words, num_processes)
print(*result)
___

Create a free account to access the full topic