In the project in the link, in step 4, I don’t understand why the size parameter in the np.random.binomial() function has to be 10,000. I know that 10,000 is the size of the town’s population, but why does that matter when choosing the number of experiments in this case?
It does, in fact, seem arbitrary to require that the number of experiments be equal to the size of the voting population. More reasonable is that proposing a larger survey of 7000 voters in step 7 recognizes that with a voting population of 10000, this would represent 70% of that population, and would theoretically generate a far more reliable conclusion.
In real life, of course, the survey itself could influence the actual results, especially if the survey results were announced prior to the election.