Riddle:

Teams A and B plays a series of games, each with three possible outcomes: A wins, B wins, or they tie. The probability that A wins is p, the probability that B wins is q, they tie with the probability r =1-p- 4. The series ends when one team has won two more games than the other, that team being declared the winner of the series. What is the probability that team A wins the series?

Python Solution:

Riddle source:

https://www.cut-the-knot.org/Probability/InPraiseOfOdds.shtml