Answer
$2$
Work Step by Step
We have
$$
\int_{0}^{\pi}|\cos x| d x= \int_{0}^{\pi/2}|\cos x| d x+\int_{\pi/2}^{\pi}|\cos x| d x\\
=\int_{0}^{\pi/2}\cos xd x-\int_{\pi/2}^{\pi}\cos x d x\\
=\sin x|_{0}^{\pi/2}-\sin x|_{\pi/2}^{\pi}\\
=1-(-1)=2
.
$$