9. (This question is worth 16 points) Suppose the inequality $\left|2^{x}-a\right|<\left|5-2^{x}\right|$ holds for all $x \in[1,2]$, find the range of real number $a$.

---

The translation is provided as requested, maintaining the original formatting and structure.
Solution: Let $t=2^{x}$, then $t \in[2,4]$, so $|t-a|<|5-t|$ holds for all $t \in[2,4]$. Since
$$
\begin{array}{l}
|t-a|<|5-t| \Leftrightarrow(t-a)^{2}<(5-t)^{2} \\
\Leftrightarrow (2 t-a-5)(5-a)<0 .
\end{array}
$$

For a given real number $a$, let $f(t)=(2 t-a-5)(5-a)$, then $f(t)$ is a linear function or a constant function of $t$. Note that $t \in[2,4]$, so $f(t)<0$ is equivalent to
$$
\left\{\begin{array}{l}
f(2)=(-1-a)(5-a)<0, \\
f(4)=(3-a)(5-a)<0,
\end{array}\right.
$$

Solving this gives $3<a<5$.
Therefore, the range of the real number $a$ is $3<a<5$. . 16 points