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.
If submitting R code, use something like
cat(round(answer1 ,3),round(answer2,3),sep = "\n").
Using two cat() calls like:
cat(round(answer1 ,3))
cat(round(answer2 ,3))
will cause submission to fail.
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))
you do the rest. :)
If submitting R code, use something like
cat(round(answer1 ,3),round(answer2,3),sep = "\n").
Using two cat() calls like:cat(round(answer1 ,3)) cat(round(answer2 ,3))
will cause submission to fail.My ans is perfectly right!Why is it giving error? I found the same ques on this website http://www.intmath.com/counting-probability/12-binomial-probability-distributions.php