Parallelizing string reversal with imap method

Report a typo

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.

Sample Input 1:

apple banana cherry
4

Sample Output 1:

elppa ananab yrrehc
Write 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)
___

Create a free account to access the full topic