Skip to main content

Probability Riddle Using Python: Getting Ahead by Two Points

 Riddle:

A and B are playing ping-pong, with the agreement that the winner of a game will get 1 point and the loser 0 points; the match ends as soon as one of the players is ahead by 2 points or the number of games reaches 6. Suppose that the probabilities of A and B winning a game are and 2/3 & 1/3, respectively, and each game is independent. Find the expectation E(ζ) for the match ending with ζ games.


Python Solution:


Riddle source:

Xiong Bin, Lee Peng Yee, Mathematical Olympiads in China (2009-2010). Problems and Solutions, World Scientific, 2013, #3