You are viewing a single comment's thread. Return to all comments →
Python 3 code:
def fact(n): return 1 if n == 0 else n*fact(n-1) def comb(n, x): return fact(n) // (fact(x) * fact(n-x)) def binomial(x, n, p): return comb(n, x) * p**x * (1-p)**(n-x) p, n = list(map(int, input().split(" "))) print(round(sum([binomial(i, n, p/100) for i in range(3)]), 3)) print(round(sum([binomial(i, n, p/100) for i in range(2, n+1)]), 3))
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Binomial Distribution II
You are viewing a single comment's thread. Return to all comments →
Python 3 code: