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)
The e-07 at the end means 10-7 (scientific notation)
so 9.5e-07 is the same as 0.00000095 (notice the 6 zeros after the decimal point)
which is very close to 0