but_atteint.py

Created by francoise-cavanne

Created on June 15, 2018

390 Bytes

loi de probabilité non équirépartie : cheminement d’un pion d’une case départ “A” vers une case arrivée “E”. Sur 4 lancers , on totalise le nombre de fois ou le jeton tombe sur 1 et on avance de ce total : on s’intéresse à la probabilité de la position finale du pion en “A”, “B”, “C”, “D” ou “E”.


from random import choice, randint

omega=["A","B","C","D","E"]
jeton=[0,1]

def position():
    somme=choice(jeton)+choice(jeton)+choice(jeton)+choice(jeton)
    return somme,omega[somme] 
   

def simul(n):
   L=[0]*5
   for i in range(n+1):
      somme,positionarri=position()
      L[somme]=L[somme]+1
   L= [i/n for i in L]
   return  L

loi_probabilite=simul(10000)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.