# -*- coding: utf-8 -*-
"""
Created on Tue Aug 10 10:55:18 2021

@author: franc
"""

import numpy.random as rd


def essaicomm(n):
    X=[n,n]
    while True:
        print(X)
        i=rd.randint(2)
        if i==0:
            print('gauche')
        else:
            print('droite')
        if X[i]==0:
            return X[1-i]
        else:
            X[i]-=1
            
# la même sans commentaires            
def essai(n):
    X=[n,n]
    while True:
        i=rd.randint(2)
        if X[i]==0:
            return X[1-i]
        else:
            X[i]-=1          
    
# moyenne pour 100 répétitions
def moyenne(n):
    c=0
    for k in range(100):
        c+=essai(n)
    return c/100
    
        