You are viewing a single comment's thread. Return to all comments →
def fac(num): if num == 1 or num == 0: return 1 else: return num * fac(num - 1) s, t = 0, 0 pcn, n = map(int, input().split()) p =pcn / 100 for i in range(0, 3): t += (fac(n) / (fac(n - i) * fac(i))) * (p ** i) * ((1 - p) ** (n - i)) print(round(t, 3)) for i in range(2, n + 1): s += (fac(n) / (fac(n - i) * fac(i))) * (p ** i) * ((1 - p) ** (n - i)) print(round(s, 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 →