from random import * def simulation(N,n,p): population=['intéressé' for n in range(round(N*p))]+['pas intéressé' for n in range(round(N*(1-p)))] shuffle(population) L=sample(population,n) return L,L.count('intéressé')/n