Let $X,Y$ topological space and $A \subset X,$ $A$ is dense in $X$. Prove that if $F:X \to Y$ is continuous and constant in $A$, then $F$ is constant in $X.$
I solved it, but I want to show you just for check my solution.
Since $F$ is constant in $A$ we have $F(A) = \{c\}$, for some constant $c \in Y$, so $cl(F(A)) = cl\{c\}= \{c\}.$
We know that $ cl(A) = X$ because $A$ is dense.
It's easy to show that $F(cl(A)) \subset cl(F(A))$ because $F$ is continuous, so we have:
$F(X) = F(cl(A)) \subset cl(F(A)) = \{c\}.$
Summarising the comments: For your (otherwise correct) proof to work we need that $\overline{\{c\}}=\{c\}$ for all $c \in Y$, i.e. $Y$ is $T_1$. You use this in in your final step of line 1 of the proof.
A non-$T_1$ counterexample is $X=\mathbb{R}$ in the usual topology with $A=\mathbb{Q}$ (dense indeed) and $Y = \{0,1\}$ in the indiscrete (trivial) topology $\{\emptyset, Y\}$ and letting $f(x)=1$ for $x \in \Bbb Q$ and $f(x)=0$ for $ x \notin \Bbb Q$. Then $f$ is continuous (all functions with codomain $Y$ are: we only check the sets $f^{-1}[\emptyset]=\emptyset, f^{-1}[Y]=X$ are open) $f$ is constant on $A$ but not on $X$.
We can get a $T_0$ example by giving $Y$ the Sierpiński topology which has one dense singleton.