Let $(X,d)$ be a metric space. $A,B$ be disjoint closed subsets of $X$. Then there must exists a continuous function $f$ on $X$, with $f(A)=0$, $f(B)=1$.
My idea is to take combination of distance function to $A, i.e$ $1-d(x,A)$. Then the function is continuous and take value 0 on $A$. But I got stuck how to take care of the values in $B$.