I am a high school student self-studying analysis, and I came across this question "Does a continuous and surjectve function from $(0,1)$ to $[0, 1]$ exist?"
Of course, because it is hard to intuit uncountability, my intuition suggests that one does not, because $(0, 1)$ is a proper subset of $[0, 1]$. However, thinking about something like $f: (0, 1) \rightarrow \mathbb{R}$ where $f(x) = \text{cot}(\pi x)$ we see that this function is onto the reals. This makes it more intuitive how a function can be onto a codomain that is a superset of its domain.
I understand now that whether a function is injective and surjective can be limited by the cardinalities of the domain and codomain, and whether or not one is a subset of the other is irrelevant.
I want to make sure I am thinking about this correctly. It still intuitively feels wrong to me that this should be possible, and I am wondering if anyone has advice on how to better think about questions of this kind.