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.
importmath# Read input from STDINinput_line=input()# Split the input into a list of valuesvalues=input_line.split()# Convert the values to the appropriate data typesp=float(values[0])/(float(values[0])+float(values[1]))q=float(values[1])/(float(values[0])+float(values[1]))n=6defbinomial():result=0foriinrange(1,7):pdf=(math.factorial(n)/(math.factorial(i)*((math.factorial(n-i)))))*(p**i)*(q**(n-i))ifi>=3:result=result+pdfprint(round(result,3))binomial()
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Binomial Distribution I
You are viewing a single comment's thread. Return to all comments →