Your formula for the law of total expectation is correct., here is how to deal with the conditional expectations :
- For the case $Y=1$ (when the student stays in the playground), you are being told that the student plays for 2 hours before restarting the process from scratch. This translates to $$\mathbb E[X\mid Y=1] = 2 + \mathbb E [X] $$
- By the same reasoning, we find for the case $Y=2$ that $$\mathbb E[X\mid Y=2] = 3 + \mathbb E [X] $$
- Lastly, the easiest case is $Y=3$, in which the student heads straight home (which takes one hour) $$\mathbb E[X\mid Y=3] = 1 $$ We now have by the law of total expectation that $$\mathbb E[X] =(2 + \mathbb E [X])\mathbb P(Y=1) + (3 + \mathbb E [X])\mathbb P(Y=2) + 1\cdot\mathbb P(Y=3) $$ Replacing with the appropriate probabilities and rearranging we find $$0.3\mathbb E[X] = 2\iff \mathbb E[X]=2/0.3 \approx 6.67$$