import scipy.stats as stats

a, b = 50, 10
mu, sigma = 37, 2
dist = stats.truncnorm((a - mu) / sigma, (b - mu) / sigma, loc=mu, scale=sigma)

count = [0]
values = [0]
for num in range(10):
    values[num] = dist.rvs(10000)
    # noinspection PyTypeChecker
    for val in values[num]:
        if val > 42:
            count[num] += 1
    print(count[num])
    count.append(0)
    values.append(0)

# all rand items stored in values
# count holds the occurrence of 42

@@ -33,32 +33,112 @@
 b = 
-50, 10%0Amu, sigma = 37, 2
+10, 50%0Amean, stdDev, limit = 37, 2, 42%0A%0Az = (limit - mean) / stdDev%0Aprobability = stats.norm.sf(abs(z))%0A
 %0Adis
@@ -167,26 +167,29 @@
  - m
-u
+ean
 ) / s
-igma
+tdDev
 , (b - m
 u) /
@@ -188,26 +188,31 @@
  - m
-u
+ean
 ) / s
-igma
+tdDev
 , loc=m
-u
+ean
 , sc
@@ -220,12 +220,13 @@
 le=s
-igma
+tdDev
 )%0A%0Ac
@@ -383,18 +383,21 @@
 f val %3E 
-42
+limit
 :%0A      

Finish part 1 from question 1, Pattern recognition