So in this exercise I was just playing around with the code to see the different answers I would get. When I picked x = 20 and n = 20 I got 9.5367431640625e-07 shouldn’t it be closer to 0.0 I mean the chance of getting 20 heads in 20 trials has to be pretty rare to the point of it never happening so why this 9.536 number?
I also noticed that when I did x = 1 and n = 5000 I get 0.0 which to me makes more sense. The chance of getting 1 head in 5000 flips would never happen.
Here is the code.
x = 20
n = 20
prob_2 = stats.binom.pmf(x, n, 0.5)
print(prob_2)