You are gonna want to use the fact that a continuous image of a connected set is connected (intervals are connected).

If it is not constant, then there are x<y in the interval for which . But as the irrationals are dense in the reals, you can be sure you can find an irrational number between these two values . But this is not in . But then you would have a separation of the image of the connected interval at . Think you can fill in the details?