Solution
= Solution
Apply part b separately to obtain continuous $g,h:X\to[0,1]$ with
$$
g^{-1}(0)=A,
\qquad
h^{-1}(0)=B.
$$
Because $A\cap B=\varnothing$, the two functions never vanish simultaneously. Hence
$$
\boxed{f=\frac{g}{g+h}}
$$
is continuous and takes values in $[0,1]$. It equals zero exactly where $g=0$, namely on $A$, and equals one exactly where $h=0$, namely on $B$.