import numpy as np
import numpy.random as rd
A = np.zeros ((1,10000))
print(A)
def une_simul () :
    de = rd.randint(1,7)
    piece = rd.randint(0,2)
    if piece == 0 or de == 1 : 
        gain = 1
    elif (piece == 1 and de == 5) or (piece == 1 and de == 6) :
        gain = -3
    else :
        gain = 0
    return (gain)

A = np.zeros((1,10000))
print(A)

for i in range(0,10000):
    gain = une_simul()
    A[0][i] = gain

print (np.mean(A))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: