#### Answer

The solution is
$$\lim_{x\to\pi}\frac{\cos x+1}{(x-\pi)^2}=\frac{1}{2}.$$

#### Work Step by Step

We will calculate this limit using L'Hopital's rule. "LR" will stand for "Apply L'Hopital's rule".
$$\lim_{x\to\pi}\frac{\cos x+1}{(x-\pi)^2}=\left[\frac{0}{0}\right][\text{LR}]=\lim_{x\to\pi}\frac{(\cos x+1)'}{((x-\pi)^2)'}=\lim_{x\to\pi}\frac{-\sin x}{2(x-\pi)}=\left[\frac{-\sin \pi}{2(\pi-\pi)}\right]=\left[\frac{0}{0}\right][\text{LR}]=\lim_{x\to\pi}\frac{(-\sin x)'}{(2x-2\pi)'}=\lim_{x\to\pi}\frac{-\cos x}{2}=\frac{-\cos\pi}{2}=\frac{1}{2}.$$