#statistics

Statistics

How likely are k successes out of n trials with P probability

from scipy.stats import binom 

n = 10
p = 0.9 

for k in range(n + 1):
    probability = binom.pmf(k, n, p)     
    print("{0} - {1}".format(k, probability))

The inverse is the Beta distribution that gives us the likelihood of a probability given a number of successes and trials.