Concept:
A function is continuous at a point \( x = a \) if:
\[
\lim_{x \to a} f(x) = f(a)
\]
If the function gives an indeterminate form at that point, we evaluate the limit using standard techniques like L'Hôpital's Rule.
Step 1: {Substitute \( x = \frac{\pi}{2} \) into the function.}
\[
f\left(\frac{\pi}{2}\right) = \frac{k \cos \frac{\pi}{2}}{\pi - 2\cdot \frac{\pi}{2}} = \frac{k \cdot 0}{\pi - \pi} = \frac{0}{0}
\]
This is an indeterminate form.
Step 2: {Apply L'Hôpital's Rule.}
\[
\lim_{x \to \frac{\pi}{2}} \frac{k \cos x}{\pi - 2x}
= \lim_{x \to \frac{\pi}{2}} \frac{-k \sin x}{-2}
= \lim_{x \to \frac{\pi}{2}} \frac{k \sin x}{2}
\]
Step 3: {Evaluate the limit.}
\[
= \frac{k \sin \frac{\pi}{2}}{2} = \frac{k}{2}
\]
Step 4: {For continuity, limit must equal function value.}
Since the function approaches \( \frac{k}{2} \), it must be finite and well-defined. Hence,
\[
\frac{k}{2} = 1 \quad \Rightarrow \quad k = 2
\]