## Problem

A basketball player is in the gym practicing free throws. He makes his first shot, then misses his second. This player tends to get inside his own head a little bit, so this isn’t good news. Specifically, the probability he hits any subsequent shot is equal to the overall percentage of shots that he’s made thus far. (His neuroses are very exacting.) His coach, who knows his psychological tendency and saw the first two shots, leaves the gym and doesn’t see the next 96 shots. The coach returns, and sees the player make shot No. 99. What is the probability, from the coach’s point of view, that he makes shot No. 100?

## Solution

```
from random import random
= 100000
runs = 0, 0
num_99s, num_99_100s for _ in range(runs):
= 2
throws = 1
hits for _ in range(3, 99):
= hits/throws
prob_next += 1
throws if random() <= prob_next:
+= 1
hits if random() <= (hits/throws):
+= 1
throws += 1
hits += 1
num_99s if random() <= (hits/throws):
+= 1
throws += 1
hits += 1
num_99_100s print(num_99_100s/num_99s)
```

The probability from the coach’s point of view that the player will make shot No.100 is *.666*.