# Disconnected metric space and continuous functions

Question: Give an example of disconnected metric space $X$ and a metric space $Y$ such that for every continuous function $f: X \to Y$, $f(X)$ is a connected subset of $Y$.

I was thinking about $\mathbb{R}$ with the discrete metric as a candidate for $X$, but then I realized that every function defined on space with the discrete metric is continuous. Correct me if I am wrong.

If $X$ is any metric space at all and $Y$ is a metric space with only one point, that does it.
If $Y$ has at least two points, $x$ and $y$, then you could have $f(w) =x$ for $w$ in one specified component of $X$ and $f(w)=y$ otherwise, and that would be continuous and $\{x,y\}$ is not connected. So there are no other examples.