Evaluate $\lim\limits_{x\to \frac{\pi}{2}} (\tan(x))^{\cos(x)}$

Evaluate$\lim\limits_{x\to \frac{\pi}{2}} (\tan(x))^{\cos(x)}$

I just had this on test I tried to use l'hopital's rule but I kept on getting $\frac{\pi}{2}$ for tans, thus it was undefined when I plugged in $\frac{\pi}{2}$

$$(\tan x)^{\cos x}=\exp\bigg(\cos x\ln(\tan x)\bigg)=\exp\left(\frac{\ln(\tan x)}{\sec x}\right)$$ Since the exponential function is continuous, you have $$\lim_{x\to\pi/2}\exp\left(\frac{\ln(\tan x)}{\sec x}\right)=\exp\left(\lim_{x\to\pi/2}\frac{\ln(\tan x)}{\sec x}\right)$$ Evaluating directly yields an indeterminate form $\dfrac{\infty}{\infty}$ (I'm implicitly assuming you're approaching $\frac{\pi}{2}$ from the left). Applying L'Hopital's rule yields $$\exp\left(\lim_{x\to\pi/2}\frac{\frac{\sec^2x}{\tan x}}{\sec x\tan x}\right)=\exp\left(\lim_{x\to\pi/2}\frac{\cos x}{\sin^2x}\right)$$ I should point out that there's more to be said if you assume $x\in\mathbb{C}$, but I'll forgo that assumption given the lack of a complex analysis tag.
First of all note that the expression $(\tan x)^{\cos x}$ is defined only when $\tan x > 0$ and hence we must have $x \to (\pi/2)^{-}$. Answer is arrived at by simply replacing $\tan x$ by $\sin x/\cos x$ and then we have \begin{align} L &= \lim_{x \to \pi/2}(\tan x)^{\cos x}\notag\\ &= \lim_{x \to \pi/2}\frac{(\sin x)^{\cos x}}{(\cos x)^{\cos x}}\notag\\ &= \dfrac{\lim_{x \to \pi/2}(\sin x)^{\cos x}}{\lim_{x \to \pi/2}(\cos x)^{\cos x}}\notag\\ &= \frac{1^{0}}{\lim_{t \to 0^{+}}t^{t}}\text{ (by putting }t = \cos x)\notag\\ &= \frac{1}{\lim_{t \to 0^{+}}\exp(t\log t)}\notag\\ &= \frac{1}{\exp(0)} = 1\notag \end{align} We have used the standard limit $\lim_{t \to 0^{+}}t\log t = 0$.