import os
import threading
import random
import time

def affichage(n):
    for i in range(10):
        time.sleep(random.random() + 0.5)   # Attend entre 0.5 et 1.5s
        print("Thread " + str(n) + " (process : " + str(os.getpid())+")")
    print("Thread " + str(n) + " terminé !")

NB_THREADS = 4
thread = [0]*NB_THREADS
for i in range(NB_THREADS):
    thread[i] = threading.Thread(target = affichage, args = [i])
    thread[i].start()

