Show that if any continuous real-valued function on a metric space $X$ attains its maximum value, then $X$ is totally bounded.
So, want to show that for every $\epsilon > 0$ there exists a finite subset $\{x_1,...,x_n\}$ of $X$ s.t. $X\subset\cup_{k=1}^nB(x_k,\epsilon)$.
I'm thinking to prove it using contrapositive, that if $X$ is not totally bounded then there exists a continuous real valued function on $X$ that is unbounded above, but I'm stuck!!
Any help would be appreciated.