[Math] Chance of rain 50%. If it rains, it rains all the way. Find average number of raining days

probability

I have a sequence of 10 days. Each day, it has a 50% chance of raining. If it rains today, it will rain on all following days as well (that is, if it first rains on day 6th, it will also rain on days 7th, 8th, 9th, 10th).

How do I find the average number of raining days?

My real problem is when the number of days is not an integer. For example, sometimes it's 8, sometimes it's 11, and on average, the number of days is 10.23. How do I calculate the average number of raining days in that case (same raining probability 50%)?

Thank you very much!

===

Edit:
I indeed meant "50% chance of starting to rain". Thanks for the clarification in the comments.

===

Edit 2:
Sorry for the confusion. I'll borrow the clarification from below, since it seems most clear: "the onset of rain (like a monsoon "breaking") has a probability of 0.5 on any day, and it will go on raining till the end thereafter".

Best Answer

If what you mean is that during this 10 day window, the onset of rain (like a monsoon "breaking") has a probability of 0.5 on any day, and it will go on raining till the end thereafter,

E(x) = $\sum_{k=1}^{10} 0.5^k\cdot(11-k) = \frac{9217}{1024}$, ≈ 9.001

This is not an integer, but as has been pointed out, that is not a problem !