Let f be a continuous function defined on a closed interval -1, 3. If f (x) is a rational number for all x in[-1, 3) , then show that f is a constant function on -1, 3.|

There is a useful discussion at the URL below. google can provide more.

math.stackexchange.com/questions/1347347/must-a-continuous-function-on-mathbb-r-with-only-rational-values-be-constant