from random import randint
def esperance_jeu(nb_sim, mise):
gain_total = 0
for _ in range(nb_sim):
gain = -mise
x = randint(1, 6)
gain += 2 * x
y = randint(1, 5)
gain += 1 if y <= 4 else 7
gain_total += gain
gain_moyen = gain_total / nb_sim
return gain_moyen
print(esperance_jeu(10**5, 8))
To embed this program on your website, copy the following code and paste it into your website's HTML: