For \( 0 \le x \le \pi \):
\[
f(x)=
\begin{cases}
\sin x, & 0 \le x \le \tfrac{\pi}{2} \\
1, & \tfrac{\pi}{2} < x \le \pi
\end{cases}
\]
At \( x=\tfrac{\pi}{2} \):
\[
\text{LHD}=\cos\!\left(\tfrac{\pi}{2}\right)=0,
\quad
\text{RHD}=0
\]
Hence differentiable.
At \( x=\pi \):
\[
\text{LHD}=0,
\quad
\text{RHD}=-\sin(\pi)=0
\]
Hence differentiable.
For \( x > \pi \), \( f(x)=2+\cos x \) is differentiable.
Therefore, \( f(x) \) is differentiable for all \( x > 0 \).