Last active
January 16, 2016 23:01
-
-
Save steelcowboy/a7d060fdb67336243d5c to your computer and use it in GitHub Desktop.
Calculator for binomial distributions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By Jim Heald | |
import math | |
while True: | |
answer = 0 | |
n = float(input('n: ')) | |
p = float(input('p: ')) | |
st = int(input('start: ')) | |
end = int(input('end: ')) | |
for x in range(st, end+1): | |
answer += (math.factorial(n)/(math.factorial(x) * math.factorial(n-x))) * p**x * (1-p)**(n-x) | |
print(answer) | |
input("Again? ") | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment