Skip to main content

Probability Riddle Using Python: Exchanging Balls of Random Colors

 Riddle:

Bob and Alice each have a bag that contains one ball of each of the colors blue, green, orange, red, and violet. Alice randomly selects one ball from her bag and puts it into Bob's bag. Bob then randomly selects one ball from his bag and puts it into Alice's bag. What is the probability that after this process the contents of the two bags are the same?


Python solution:


Riddle source:

https://artofproblemsolving.com/wiki/index.php/2006_AMC_10B_Problems/Problem_17