Riddle:

A man condemned to death in the State of Randomana is presented with the following probabilistic situation. He is given two similar bags, 10 white balls, and 10 black balls. He is asked to distribute the balls between the two bags as he wishes. Afterward, he will be blindfolded and allowed to randomly choose one of the bags. Then he will blindly draw one ball from the chosen bag. If he draws a black ball, he will be executed. However, if he draws a white ball, he will be pardoned. How should this unfortunate prisoner distribute the balls between the bags in the most favorable manner, namely, so that the probability of drawing a white ball at the end of the process is maximal?

Python Solution:

Riddle source:

https://archive.org/details/understandingpro0000falk/page/48/mode/2up?q=2.3.9