Let $M$ be a metric space. If every continuous function $f : M \rightarrow \mathbb{R}$ has compact range then $M$ is compact.
I got this question from "Real Mathematical Analysis" by Charles Chapman Pugh. Specifically Exercise 118 in Chapter 2. I'm not sure how to go about proving this question, but it seems useful for another equivalence of what it means for a metric space to be compact.
EDIT: I don't see how this question is a duplicate of the other link in question. Or I at least don't understand how it is a duplicate.