In [61]:
import numpy as np
import matplotlib.pyplot as plt

In [99]:
qtd = 1e6
rep = int(qtd)
s = 0
i = 0
n = 240
for i in range(0, rep):
    num = np.random.random_integers(1, high=6, size=n)
    counts = np.bincount(num)[1:]
    if (np.max(counts) > 57 or np.min(counts) < 23):
        s += 1
    if (i % 100000 == 0):
        print(str(i) + ' - ' +str(s/(i+1)*100))

print(str(s/qtd*100))


0 - 0.0
100000 - 1.4959850401495984
200000 - 1.4979925100374498
300000 - 1.4739950866830445
400000 - 1.465746335634161
500000 - 1.4641970716058568
600000 - 1.4628308952818412
700000 - 1.4722836110234128
800000 - 1.4773731532835586
900000 - 1.476887247903058
1000000 - 1.4641985358014642
1100000 - 1.4642713961169127
1200000 - 1.4611654490287924
1300000 - 1.4598450308884376
1400000 - 1.4639275257660531
1500000 - 1.4615990256006497
1600000 - 1.4644365847271346
1700000 - 1.4632932568863195
1800000 - 1.4633325203708218
1900000 - 1.4616834412192414
2000000 - 1.4582492708753645
2100000 - 1.458808829138653
2200000 - 1.459862972789558
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-99-ea383d74b61d> in <module>()
      7     num = np.random.random_integers(1, high=6, size=n)
      8     counts = np.bincount(num)[1:]
----> 9     if (np.max(counts) > 57 or np.min(counts) < 23):
     10         s += 1
     11     if (i % 100000 == 0):

/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py in amin(a, axis, out, keepdims)
   2212     else:
   2213         return _methods._amin(a, axis=axis,
-> 2214                             out=out, keepdims=keepdims)
   2215 
   2216 def alen(a):

/usr/lib/python3/dist-packages/numpy/core/_methods.py in _amin(a, axis, out, keepdims)
     19 def _amin(a, axis=None, out=None, keepdims=False):
     20     return um.minimum.reduce(a, axis=axis,
---> 21                             out=out, keepdims=keepdims)
     22 
     23 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):

KeyboardInterrupt: 

In [110]:
qtd = 1e6
rep = int(qtd)
s = 0
i = 0
n = 240
for i in range(0, rep):
    num_mtr = np.random.random_integers(1, high=6, size=(n, 5)    
    counts = np.bincount(num)[1:]
    if (np.max(counts) > 57 or np.min(counts) < 23):
        s += 1
    if (i % 100000 == 0):
        print(str(i) + ' - ' +str(s/(i+1)*100))

print(str(s/qtd*100))


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-110-a653fe6a4985> in <module>()
      8     r[0] = r[0] * 1.375
      9     for j in range(0, n):
---> 10         num[j] = r[:][j].index(np.max(r[:][j]))
     11     counts = np.bincount(num)[1:]
     12     if (np.max(counts) > 57 or np.min(counts) < 23):

AttributeError: 'numpy.ndarray' object has no attribute 'index'

In [118]:
a = np.random.random_integers(1, high=6, size=(4, 5))
a
a[0]


Out[118]:
array([4, 4, 4, 4, 2])

In [108]:
a[0]*1.375


Out[108]:
array([ 0.79358524,  0.20874913])

In [ ]: