Solution (source code)

= Solution

Let $I_j$ be the <indicator random variable> of an apple in lunch $j$. The number remaining is $R=5-I_1-I_2-I_3$. Each <expected value> $E[I_j]=P(A_j)=1/2$. The <linearity of expectation> therefore gives
$$
\boxed{E[R]=5-3\left(\frac12\right)=\frac72\text{ apples}.}
$$
Although the <indicator random variables> are dependent under <sampling without replacement>, the <linearity of expectation> needs no <independence> assumption.