import time
import concurrent.futures
import threading


start = time.perf_counter()

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



#t1 = threading.Thread(target=do_something) # we do not add () because we do not want to run it. We just gave thread 1 that this function exist
#t2 = threading.Thread(target=do_something)

with concurrent.futures.ThreadPoolExecutor() as executur:
    secs = [5,4,3,2,1]
    results = executur.map(do_something,secs)

    for result in results:
        print(result)
# threads = []
#
# for _ in range(10):
#     t = threading.Thread(target=do_something, args=[1.5])
#     t.start()
#     threads.append(t)
#
# for thread in threads:
#     thread.join()

finish = time.perf_counter()

print(f'Finished in {round(finish-start,2)} second(s)')