Skip to main content

Probability Riddle Using Python: Playing with Balls of Two Colors


An urn contains balls of two colors - black and white - at least one of each. You draw balls at random. In a round of ball drawings, you draw a ball, discharge it but note its color. You continue drawing and discharging the balls as long as they are of the same color. The first ball of a different color is placed back into the urn. This ends the round. The next and all successive rounds are played until the urn becomes empty. You win if the last to be drawn is black. How many balls of each color in the urn should you start with to maximize your probability of winning?

Python Solution/Assistance:

Riddle source:

P. Winkler's Mathematical Mind-Benders (A K Peters/CRC Press, 2007, pp 76, 79-80)