Step 1: State the continuity condition.
A function is continuous at a point when the limit as we approach that point equals the value the function takes there. Here the value at $x = \frac{\pi}{2}$ is given as $3$, so the limit must also equal $3$.
Step 2: Write the requirement.
We need the limit of $\frac{k\cos x}{\pi - 2x}$ as $x \to \frac{\pi}{2}$ to be $3$. If we plug in directly we get $\frac{0}{0}$, so we need a substitution to clean it up.
Step 3: Shift the variable.
Let $x = \frac{\pi}{2} + h$. As $x$ goes to $\frac{\pi}{2}$, the small amount $h$ goes to $0$.
Step 4: Rewrite top and bottom.
For the top, $\cos\left(\frac{\pi}{2} + h\right) = -\sin h$. For the bottom, $\pi - 2\left(\frac{\pi}{2} + h\right) = -2h$.
\[ \frac{k(-\sin h)}{-2h} = \frac{k\sin h}{2h} \]
Step 5: Use the basic sine limit.
We know $\frac{\sin h}{h} \to 1$ as $h \to 0$. So the limit becomes $\frac{k}{2}$.
\[ \lim_{h\to 0} \frac{k\sin h}{2h} = \frac{k}{2} \]
Step 6: Set this equal to 3 and solve.
For continuity this limit must be $3$.
\[ \frac{k}{2} = 3 \implies k = 6 \]
\[ \boxed{k = 6} \]