You are provided with a list of text strings. Your task is to write a Python program that reverses each string in the list using the imap method of the Pool class to allow for streaming processing of data. This way, you can start processing the results as soon as they become available.
Multiprocessing pool
Parallelizing string reversal with imap method
Report a typo
Sample Input 1:
apple banana cherry
4Sample Output 1:
elppa ananab yrrehcWrite a program in Python 3
from multiprocessing import Pool
def streaming_reverse(texts, num_processes):
# Your code here
if __name__ == "__main__":
texts = input().split()
num_processes = int(input())
result = streaming_reverse(texts, num_processes)
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
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.