Possibility of finding a such function? Is it possible to find a continuous function $f$: $[0,1]$ $\rightarrow$ {$0,1$} that is onto?
My thoughts: I know if $A$ & $B$ are two subsets of a top. space $X$ and if there exists a continuous function $f$: $X$ $\rightarrow [0,1]$ s.t $f(A)=${0} & $f(B)=${1}, we say $A$ & $B$ can be a separated by a continuous function $f$.
But the problem is $[0,1]$ is connected and hence can't find a separation of it.Is it possible to find such a function?. 
Alternatively, I know Urysohn lemma and the definition of a completely regular space(which are somewhat related to this but not quite). Any thoughts?
 A: This is not possible. If $X,Y$ are topological spaces with $X$ connected and $f: X\to Y$ is continuous, then $f(X)\subset Y$ is connected. Since $\{0,1\}$ (with discrete topology) is disconnected, there exists no such surjective $f$
A: If it is onto then $f^{-1}(0)$ and $f^{-1}(1)$ are disjoint closed non-empty subsets of $[0,1]$ which contradicts connectedness of $[0,1]$. Hence such a function does not exist. 
A: Proposition: let $X$ be a topological space, then TFAE:


*

*$X$ is connected.

*If $O \subseteq X$ is clopen (closed and open), $O=\emptyset$ or $O=X$.

*Every continuous $f:X \to \{0,1\}$ (the two point set in the discrete topology) is constant.


Proof: $1 \implies 2$: If $O$ were clopen and not empty and not equal to $X$, $\{O, X\setminus O\}$ would be a disconnection of $X$ (both sets are open, non-empty and trivially disjoint), contradiction. 
$2\implies 3$: If $f: X \to \{0,1\}$ is continuous, then $f^{-1}[\{0\}]$ is clopen as the inverse image of a clopen set, so is empty (and $f \equiv 1$) or $X$ (and $f \equiv 0$).
$3 \implies 1$: Suppose $X= U \cup V$ were a disconnection of $X$. Then the function $f$ sending all points of $U$ to $0$ and all points of $V$ to $1$ is well-defined ($U$ and $V$ are disjoint) and continuous (pasting lemma using that $U,V$ are open and constant maps are continuous) and non-constant (both sets are non-empty). This contradiction shows $X$ is connected.
As $[0,1]$ is connected, no such map as you look for exists.
