3. Let $0<x<\pi$, the minimum value of the function $y=\frac{2-\cos x}{\sin x}$ is ( ).
A. 3
B. $\sqrt{3}$
C. 2
D. $2-\sqrt{3}$
3. B.

Transform the function to $y \sin x + \cos x = 2$, then we have $y^2 + 1 \geq 2^2$, which means $y \geq \sqrt{3}$ or $y \leq -\sqrt{3}$. Also, since $0 < \sin x < 2 - \cos x$, we have $y > 0$. Therefore, $y_{\min} = \sqrt{3}$, which is achieved when $x = \frac{\pi}{3}$.