Let\'s say that I know the probability of a \"success\" is P. I run the test N times, and I see S successes. The test is akin to tossing an unevenly weighted coin (perhaps
I can't totally vouch for the efficiency, but Scipy has a module for this
from scipy.stats.distributions import binom binom.cdf(successes, attempts, chance_of_success_per_attempt)