# problem 436 - project euler

Julie proposes the following wager to her sister Louise. She suggests they play a game of chance to determine who will wash the dishes. For this game, they shall use a generator of independent random numbers uniformly distributed between $0$ and $1$.

The game starts with $S = 0$. The 1st player, Louise, adds to S di erent random numbers from the generator until $S > 1$ and records her last random number, $x$.

The second player, Julie, continues adding to S di erent random numbers from the generator until $S > 2$ and records her last random number, $y$.

The player with the highest number wins and the loser washes the dishes, i.e. if $y > x$, the second player wins.

For example, if the 1st player draws $0.62$ and $0.44$, the 1st player's turn ends since $0.62+0.44 > 1$ and so $x = 0.44$.

If the second player draws $0.1$, $0.27$ and $0.91$, the second player's turn ends since $0.62 + 0.44 + 0.1 + 0.27 + 0.91 > 2$ and so $y = 0.91$.

Since $y > x$, the second player wins.

Estimate the probability of the second player winning, accurate to $10$ decimal places.

This is the problem. I'm new to python and i would really appreciate if someone can help me get started on coding with probability in python

• You can find a detailed solution here. If you're also new to probabilities, you might find it hard to understand the solution since this is an advanced problem of PE. – Blencer Jan 4 '17 at 23:12
• Thanks @Guru, the maths solution is a big help, but i'm having great difficulty putting that into python – anjith varghese Jan 5 '17 at 8:39