I had this homework problem:
If $f(x)$ is continuous in $[0,1]$ and $f(x)=1$ for all rational numbers in $[0,1]$, then $f(\frac{1}{\sqrt{2}})$ is equal to $1$.
My logic for marking it false was that there are infinite irrational numbers for each rational number, so the immediate neighbourhood of an irrational number must also be irrational. Since the immediate neighbourhood is not rational, it doesn't have to necessarily be equal to 1, but the given answer was true.
My teacher said that we can't be sure if the immediate neighbourhood of $\frac{1}{\sqrt{2}}$ is irrational or rational, so $f(x)$ will be $1$ for irrational numbers as well.
Are any of us two correct?