echan.py

Created by fatih-pinar

Created on April 25, 2018

463 Bytes

Succession de fonctions permettant de créer un échantillon de nombres pseudos-aléatoires, de réaliser une simulation et enfin de prendre une décision sur l’échantillon considéré


from random import *
from math import *

def echantillon(n):
    L=[]
    for i in range(n):
        L=L+[random()]
    return(L)

def simuler(L,p):
    c=0
    for i in range(len(L)):
        if L[i]<=p:
            c=c+1
    return(c/len(L))

def prisededecision(L,valth,valobs):
    a=valth-1/sqrt(len(L))
    b=valth+1/sqrt(len(L))
    if valobs<a or valobs>b:
        return("hypothese rejetee")
    else:
        return("hypothese non rejetee")