from random import *

def X():
    a=random()
    if a<=0.8:
        x=1
    else:
        x=0
    return x

def Réussis(n):
    somme=0
    for k in range(n):
            somme=somme+X()
    return somme

def Moyenne(n):
    m=Réussis(n)/n
    return m

def Distance(n):
    d=abs(Moyenne(n)-0.8)
    return d

def Proportion(N,n,alpha):
    tot=0
    for k in range(N):
        if Distance(n)<=alpha:
            tot=tot+1
    p=tot/N
    return p


