Solution (source code)

= Solution

The products $xy$ with $x\in L_1$ and $y\in L_2$ span the <field compositum> $L_1L_2$ over $K$, so
$$
[L_1L_2:K]\leq d_1d_2.
$$
The <tower law> gives
$$
[L_1L_2:K]
=d_1[L_1L_2:L_1]
=d_2[L_1L_2:L_2].
$$
Thus the degree is divisible by both $d_1$ and $d_2$. Since they are coprime, it is divisible by $d_1d_2$. Combining divisibility with the upper bound gives
$$
\boxed{[L_1L_2:K]=d_1d_2}.
$$
Equivalently, finite extensions of coprime degrees are <linearly disjoint field extensions>.