I am a physics student and have just recently started studying about topology. I am trying to apply the topological definition of continuity in this function. $$f:(0,2)\rightarrow(0,1]\cup(2,3)$$ $$f(x) = \begin{cases} x, & \text{ if } x \in (0,1]\\ x+1, &\text{ if } x \in (1,2) \end{cases}$$
I think that the co-domain of this function is not a topological space because the co-domain itself is not an open set and so it doesn't fit in the definition of a topology. So, is it so that we can't apply topological definition in this case or am I wrong somewhere?
The set $\left(0, 1\right] = \left(0, \frac32\right) \cap \Big((0,1] \cup (2,3)\Big)$ is an open set in the codomain $(0,1] \cup (2,3)$. We have
$$f^{-1}\Big(\left(0, 1\right]\Big) = \left(0, 1\right]$$
which is not an open set in $(0,2)$. Therefore $f$ is not continuous.