<jupyter_start><jupyter_text>The Binomial DistributionThe Binomial Distribution helps us determine the probability of a string of independent 'coin flip like events'.The probability mass function associated with the binomial distribution is of the following form:$P(X = x) = \frac{n!}{x!(n-x)!}p^x(1-p)^{n-x}$ where n is the number of events, x is the number of "successes", and p is the probability of "success".We can now use this distribution to determine the probability of things like:The probability of 3 heads occurring in 10 flips.The probability of observing 8 or more heads occurring in 10 flips.The probability of not observing any heads in 20 flips.*Reference:* [udacity](https://eu.udacity.com/course/data-analyst-nanodegree--nd002), Chapter 4, Lesson 5<jupyter_code># imports
from math import factorial as fact
# initialize variables
# change these variable values to use function
n = 10 # number of events
x = 3 # number of True outcomes
p = .15 # probability of True outcome
P = 0
# set up equation
P = (fact(n) / (fact(x) * fact(n-x))) * p**x * (1-p)**(n-x) 
round(P,4)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09946236559139784, 'fraction_numerical': 0.01971326164874552, 'mean_word_length': 5.005376344086022, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '383752', 'license': 'MIT', 'n_tokens_mistral': 348, 'n_tokens_neox': 319, 'n_words': 144, 'path': 'stats_lessons/BinomialDistribution.ipynb', 'repo_name': 'Zabamund/datasci-nano', 'size': '1116'}