from random import randint
from numpy import arange
from matplotlib.pyplot import bar, show, legend
C = [0 for i in range(13)]
for i in range(100):
N = 0
for k in range (12):
N = N + randint(0,1)
C[N]=C[N]+1
F=[j/106 for j in C]
X=[0.000244141,0.002929688,0.016113281,0.053710938,0.120849609,0.193359375,0.225585938,0.193359375,0.120849609,0.053710938,0.016113281,0.002929688,0.000244141]
x = arange(0,13,1)
bar(x,F,label="fréquence observées",color='green',alpha=0.5)
bar(x,X,label="probabilités théoriques",color='red',alpha=0.5)
legend()
show()