Continuous map and irrational numbers My question is the following :

Let $f:\mathbb{R}\to\mathbb{R}$ be a continuous map such as each irrational number is mapped to a rational number (i.e. $f(\mathbb{R}\backslash\mathbb{Q})\subset\mathbb{Q}$). Show that $f$ is a constant map.

What I have done :
Let's suppose that $f$ is not a constant map, i.e. it exists $x,y\in\mathbb{R}$ such that $f(x)\neq f(y).$ As $f$ is continuous, the intermediate value theorem gives us that $[f(x),f(y)]\subset f([x,y]).$ But, as $$f([x,y])\subset f(\mathbb{R})=f(\mathbb{R}\backslash\mathbb{Q}\,\cup\,\mathbb{Q})=f(\mathbb{R}\backslash\mathbb{Q})\,\cup\,\bigcup_{n\in\mathbb{N}}\{f(p_n)\}\subset\mathbb{Q}\,\cup\,\bigcup_{n\in\mathbb{N}}\{f(p_n)\},$$ where $p_n$ is a sequence which describes $\mathbb{Q},$ we would get that $[f(x),f(y)]$ is a subset of a countable set and so is countable, which is a contradiction and so $f$ is constant.
My questions :
Is my proof correct, and if yes, does someone see an other way to answer it ?
Thank you for your comments, and happy new year !

Very good proof! It is correct.
