import concurrent.futures
import time
start=time.perf_counter()
def do_something(seconds):#seconds is the args to the do_something_function
    print(f"Sleeping for {seconds} second(s)")
    time.sleep(seconds)
    return f"Done Sleeping for {seconds} time"
seconds_time=[5,4,3,2,1]
with concurrent.futures.ProcessPoolExecutor() as executor:
    results=[executor.submit(do_something,sec) for sec in seconds_time]
    # results=executor.map(do_something,seconds_time)
    for result in results:
        # print(result)
        print(result.result())
finish=time.perf_counter()
print(f"Time Difference {round(finish-start,2)}")


81b53abc0f9ca45d3516807608aa3f2cd9562280
<mask token>


def do_something(seconds):
    print(f'Sleeping for {seconds} second(s)')
    time.sleep(seconds)
    return f'Done Sleeping for {seconds} time'


<mask token>

<mask token>


def do_something(seconds):
    print(f'Sleeping for {seconds} second(s)')
    time.sleep(seconds)
    return f'Done Sleeping for {seconds} time'


<mask token>
with concurrent.futures.ProcessPoolExecutor() as executor:
    results = [executor.submit(do_something, sec) for sec in seconds_time]
    for result in results:
        print(result.result())
<mask token>
print(f'Time Difference {round(finish - start, 2)}')

<mask token>
start = time.perf_counter()


def do_something(seconds):
    print(f'Sleeping for {seconds} second(s)')
    time.sleep(seconds)
    return f'Done Sleeping for {seconds} time'


seconds_time = [5, 4, 3, 2, 1]
with concurrent.futures.ProcessPoolExecutor() as executor:
    results = [executor.submit(do_something, sec) for sec in seconds_time]
    for result in results:
        print(result.result())
finish = time.perf_counter()
print(f'Time Difference {round(finish - start, 2)}')

import concurrent.futures
import time
start = time.perf_counter()


def do_something(seconds):
    print(f'Sleeping for {seconds} second(s)')
    time.sleep(seconds)
    return f'Done Sleeping for {seconds} time'


seconds_time = [5, 4, 3, 2, 1]
with concurrent.futures.ProcessPoolExecutor() as executor:
    results = [executor.submit(do_something, sec) for sec in seconds_time]
    for result in results:
        print(result.result())
finish = time.perf_counter()
print(f'Time Difference {round(finish - start, 2)}')

import concurrent.futures
import time
start=time.perf_counter()
def do_something(seconds):#seconds is the args to the do_something_function
    print(f"Sleeping for {seconds} second(s)")
    time.sleep(seconds)
    return f"Done Sleeping for {seconds} time"
seconds_time=[5,4,3,2,1]
with concurrent.futures.ProcessPoolExecutor() as executor:
    results=[executor.submit(do_something,sec) for sec in seconds_time]
    # results=executor.map(do_something,seconds_time)
    for result in results:
        # print(result)
        print(result.result())
finish=time.perf_counter()
print(f"Time Difference {round(finish-start,2)}")

