This is from Real Mathematical Analysis by Pugh, problem 2.85(a).
I've seen proofs but they've used concepts that haven't been covered up to this point, like the Tietze extension theorem, metrizable compactifications, etc.
I'm wondering what the proof is that was probably intended by the author, something relatively nice, which explicitly uses the metric (after all, the statement is false in general), and doesn't invoke any concepts that aren't in the first two chapters of the book.
This is a homework problem, and I'm just looking for a hint.
An approach my friend proposed is to assume the space isn't compact, use this to show that there exists an infinite sequence of disjoint open balls $(B_n)$, define a sequence of functions $(f_n)$ where $f_i$ is zero outside $B_i$ and inside $B_i$ increases linearly with distance from the center up to a maximum of $i$, and then obtain unbounded function $g(x) = \sum_{n=1}^\infty f_n(x)$. However it seems to me that there might be some point which is not inside any ball but each of whose neighbourhoods intersects infinitely many of the balls, which seems to be problematic for the supposed continuity of $g$.