Project 19: Binomial Probability

Binomial Explanation: Suppose you have a 30% chance of winning a certain game of chance every time you play it.  Suppose you decide to play the game 3 times.  We are concerned with the number of games you would win.  Let's call the number of games you would win X.

Project 19: Variables 'n', 'p', and 'k' have been initialized.  There is also a working method called combinations

n is the number of trials (10 in the last example)

p is the probability of success on every trial (.2 in the last example)

k is the number of successes that we are trying to calculate the probability of (3 in the last example)

combinations(n,k) returns how many ways to choose k elements from n elements

examples: 

combinations(3, 1) = 3

combinations(10, 3) = 120

Task: Appropriately assign the value of the variable 'binompdf' that represents the probability of getting k successes out of n trials (with p as the probability of success on every trial).

**If your code works for 5 test cases in a row, you can enter your e-mail address.