I study programming in Python in my free-time. I have thought to a problem I am trying to solve. I would like to have a flavor of the statistical approach then use Monte Carlo simulations to verify the theory.

I would like to analyse the following process of tossing a (fair) coin and get two heads in a row with one initial try and a fixed number of tries for the second toss.

Rules are: after the first toss, if Heads comes, you have 4 tosses, if you fail to get Heads in the second toss, you have 1 fail per each toss. If you get Tails in the first toss you have 4 fails.

I consider here 2 initial tosses:

- I get Tails, then I have 4 fails

- I get Heads, then I have 4 x 0.5 chance of getting Heads again

Is there a way to calculate the probability to get Heads in such a process?