• + 0 comments

    from math import factorial as fact

    Permutation

    def permutation(n, r): return fact(n)/(fact(n-r))

    Combinations

    def combination(n, r): return permutation(n,r)/fact(r)

    BINOMIAL DISTRIBUTION

    def binomial_dist(n, x, p):

    q = 1-p

    return combination(n, x)*(p**x)(q*(n-x))

    The rest you can do :)