Code would be:
However, before using any tool [R/Python/ or anything else for that matter], You should try to understand the concept.
Concept of Binomial Distribution:
Let’s assume that a trail is repeated n times. The happening of an event is called a success and the non-happening of the event is called failure.
Let ‘p’ be the probability of success and ‘q’ be the probability of failure in a single trial so that
p + q = 1
We assume that all trails are independent and ‘p’ and ‘q’ are the same in each trial.
Now, by compound probability theorem for independent events, the probability that first ‘r’ trails are the success and remaining ‘n – r’ trails are failure is
This expression shows the probability of ‘r’ continuous success and ‘n – r’ continuous failures. However, ‘r’ successes in n trials can occur in nCr ways [Combinations of n things, taken r at a time: nCr = n! / r!(n - r)! = nPr / r! ]
Hence by multiplication theorem or probability/compound probability theorem/counting principle for independent events [insert hyperlink], the probability of getting ‘r’ success in ‘n’ trails is given by
P (r) = nCr p^r q^n-r, where ‘r’ can be considered as a discrete random variable which takes values from 0, 1, 2, …, up to maximum ‘n’
So theoretically too, x [binomial variate] taking value less than zero is not possible. And
prob[x <= 0 ] = p[x = 0] = q^n
In your case this quantity is negligible.
I hope it helps!