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 such as \( \frac{0}{0} \), we evaluate the limit using standard limit techniques.
Step 1: Check the value of the function at \( x = \frac{\pi}{2} \).
\[
f\left(\frac{\pi}{2}\right)
=
\frac{k\cos\left(\frac{\pi}{2}\right)}{\pi-2\left(\frac{\pi}{2}\right)}
=
\frac{k\cdot0}{\pi-\pi}
=
\frac{0}{0}.
\]
Thus, the expression gives an indeterminate form.
Step 2: Evaluate the limit \( \lim_{x\to\frac{\pi}{2}} f(x) \).
\[
\lim_{x\to\frac{\pi}{2}} \frac{k\cos x}{\pi-2x}
=
k\lim_{x\to\frac{\pi}{2}}\frac{\cos x}{\pi-2x}.
\]
Let \( h = x-\frac{\pi}{2} \). As \(x\to\frac{\pi}{2}\), \(h\to0\).
\[
\cos x
=
\cos\left(\frac{\pi}{2}+h\right)
=
-\sin h
\approx -h
\]
\[
\pi-2x
=
\pi-2\left(\frac{\pi}{2}+h\right)
=
-2h
\]
Therefore,
\[
\lim_{x\to\frac{\pi}{2}}\frac{\cos x}{\pi-2x}
=
\frac{-h}{-2h}
=
\frac{1}{2}.
\]
Step 3: Apply the continuity condition.
\[
\lim_{x\to\frac{\pi}{2}} f(x)
=
k\left(\frac{1}{2}\right).
\]
For continuity, the limit must be finite and well-defined, giving
\[
k\left(\frac{1}{2}\right)=1
\]
\[
k=2.
\]
Thus,
\[
\boxed{k=2}
\]