We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 4: Binomial Distribution II
Day 4: Binomial Distribution II
Sort by
recency
|
156 Discussions
|
Please Login in order to post a comment
Python 3 code:
import math
x, y = map(int,input().split()) p = x/100 q = 1-p
no_more_than_two = []
for i in range(3): val = math.comb(y,i)p*(i)q*(y-i) no_more_than_two.append(val) print(round(sum(no_more_than_two),3))
at_least_two = []
for i in range(2, y+1): val = math.comb(y,i)p*(i)q*(y-i) at_least_two.append(val) print(round(sum(at_least_two),3))