Solution (source code)

= Solution

The <expected value> follows by <integration by parts>:
$$
E[X]=\frac12\int_0^\pi x\sin x\,dx
=\frac12[-x\cos x+\sin x]_0^\pi=\boxed{\frac\pi2.}
$$
The same result follows from symmetry of the <probability density function> about $\pi/2$.