def graphique(n,k): L=[1]*k x=[0] y=[k] z=[k//2]*(n+1) nb=k for i in range(n): choix=randint(0,k-1) #On choisit une boule au hasard x.append(i) if L[choix]==1: L[choix]=2 #Si elle est dans l'urne 1, on la met dans la 2 nb=nb-1 else: L[choix]=1 #Si elle est dans l'urne 2, on la met dans la 1 nb=nb+1 y.append(nb) pl.plot(x,y) pl.plot(x,z) pl.show() return L.count(1)/k