In: Computer Science
Python CODE for this question:
There are 2 red marbles and 98 blue marbles in a jar. Draws are made at random with replacement. Find the smallest number of draws needed such that the probability is greater than 1/2 that a red marble is drawn at least once.
Python code for the same :
To use log() function in python, there is a library named math, so I imported that.
I have just written simplified logic described above in python.
import math
n = math.log(0.5)/(math.log(49) - math.log(50))
print(n)
Output :
Like, if this helped :)