Note Do not close this question like It was done earlier. Question is different so I am asking a new question. l am not supposed to use connectedness here Mine is a basic real analysis course. Thanks.
Question
Does there exist a continuous function $f:\mathbb{R} \to \mathbb{R}$ satisfying $$f\left(x\right) \in\mathbb{Q} \text{ for all } x \in \mathbb{R}-\mathbb{Q}$$ and $$f\left(x\right) \in \mathbb{R}-\mathbb{Q} \text{ for all } x \in \mathbb{Q}$$??
Attempt I do not really know what to do. I don't know whether to prove or to disprove
Hint: show that such a function takes only countably many values. But the Intermediate Value Theorem says ...