Let $I\in R$ be a nonemplty set. Show that $I$ is an interval iff any continuous function $f:I\rightarrow \{0,1\}$ is constant.
I've no idea how to handle this problem. Thanks in advance to anyone who comes up with a step - solution.
PS: I've asked a similar problem to this, but the community pointed out that the "problem" consisted of a contradiction. Indeed, due to my mistake, the question was asked wrongfully. Thanks to the people who pointed that out!