$\liminf$ and $\limsup$ question I am trying to learn about $\liminf$ and $\limsup$, as I have struggled with the definition of these, and mostly just avoided questions about this in the past. I have had a go at answering a question posted earlier, but do not feel confident enough with my attempt to post an answer. I have had a go at answering it, and will put my 'proof' here. If I can get some advice on where (if anywhere) I have gone wrong, or any nice tricks I have missed out on using I would be grateful

Question:
Let $f:(0,1) \rightarrow \mathbb{R}$ be a continuous function in the standard euclidean metric space $($$\Bbb R$,$d_2$$)$. Let
$\displaystyle\liminf_{x\rightarrow0} f(x)<\limsup_{x\rightarrow0} f(x).$
Prove that for every $l \in (\liminf_{x\rightarrow0} f(x),\limsup_{x\rightarrow0} f(x))$ there exists a sequence $x_{n}$ in $(0,1)$ that converges to $0$ and such that $\lim_{n\rightarrow \infty} f(x_{n}) = l$
My Attempt:
I first denote
$\displaystyle I \equiv \left(\liminf_{x\rightarrow0} f(x),\ \limsup_{x\rightarrow0} f(x)\right)$
and let
$y_{n} = f(x_{n})$. 
Then
$\displaystyle I = \left( \liminf_{n\rightarrow\infty}f(x_{n}), \limsup_{n\rightarrow\infty}f(x_{n}) \right)\\
\ \ =\displaystyle \left( \liminf_{n\rightarrow\infty}y_{n}, \limsup_{n\rightarrow\infty}y_{n}\right).$
As I understand it $\liminf$ is the largest lower bound of all limit points of subsequences of the sequence $\{y_{n}\}$, and $\limsup$ is the lowest upper bound of all limit points of subsequences of the sequence $\{y_{n}\}$. Hence for arbitrary $l \in I$, there is a subsequence $\{y_{n_{k}}\}$ such that
$\displaystyle\lim_{k\rightarrow\infty}y_{n_{k}} = l.$
Expanding out
$\displaystyle\lim_{k\rightarrow\infty}y_{n_{k}} = \lim_{k\rightarrow\infty}f(x_{n_{k}}) \\
\qquad \quad\ =\displaystyle f\left(\lim_{k\rightarrow\infty}x_{n_{k}}\right) \quad \text{(by continuity of } f\text{)}.$
Now $\lim_{k\rightarrow\infty}x_{n_{k}} = 0$, so I have found a sequence $\{x_{n}\}$ such that $\lim f(x_{n}) = l$, and since $l \in I$ was arbitrary this means we can do this for all $l \in I$.

I can't see a flaw in this reasoning, but the reason that I am dubious about this is that I have really struggled with $\liminf$ and $\limsup$ in the past, whereas this seemed quite easy.
Thanks for reading,
Keeran
 A: Let $\underline{f} = \liminf_{x \to 0} f(x)$,  $\overline{f} = \limsup_{x \to 0} f(x)$. Let $l \in (\underline{f}, \overline{f})$. Choose $\epsilon>0$ such that $B(l,\epsilon) \subset (\underline{f}, \overline{f})$.
By definition of $\liminf, \limsup$, the sets $L = \{ x | f(x)< \underline{f} +\epsilon \}$ and $U = \{ x | f(x)> \overline{f} -\epsilon \}$ must have $0$ as a limit point.
Define the sequences $\underline{x_n}, \overline{x_n}$ as follows:
First pick $\underline{x_1} \in L$, $\overline{x_1} \in U \cap (0,\underline{x_1})$. Then choose
$\underline{x_{n+1}} \in L \cap (0,\min(\frac{1}{n}, \overline{x_n}))$,
$\overline{x_{n+1}} \in U \cap (0,\underline{x_{n+1}})$. It should be clear that $\underline{x_n} \to 0, \overline{x_n} \to 0$.
$f$ is continuous. Since $f(\overline{x_n}) > \overline{f} -\epsilon$,  $f(\underline{x_n}) < 
\underline{f} +\epsilon$, we have $l \in ( f(\underline{x_n}), f(\overline{x_n}))$, hence using the intermediate value theorem we can find $\xi_n \in (\overline{x_n}, \underline{x_n})$ such that $f(\xi_n) = l$.
It follows that $\lim_n \xi_n = 0$ and since $f(\xi_n) = l$, we have $\lim_n f(\xi_n) = l$.
Addendum: To see why $U,L$ have zero as a limit point:
$\underline{f} = \liminf_{x \to 0} f(x) = \lim_{\delta \downarrow 0} \inf_{x \in (0,\delta)} f(x)$. Note that $\delta \mapsto \inf_{x \in (0,\delta)} f(x)$ is non-decreasing. Hence  $\inf_{x \in (0,\delta')} f(x) \le \underline{f}$ for all $\delta' \in(0,\delta]$. In particular, by definition of $\inf$, this means that for all $\epsilon>0$, and for all $\delta'\in (0,\delta]$, there is some $x \in (0,\delta')$ such that $f(x) < \underline{f}+\epsilon$ (otherwise, the $\liminf$ would be $\ge \underline{f}+\epsilon$). Hence $0$ is a limit point of $L$. $U$ is dealt with similarly.
