A function f:X→Y is continuous at x0 if for every ε>0 there exists δ>0 such that ∣x−x0∣<δ implies ∣f(x)−f(x0)∣<ε.
Every continuous function on a compact set attains its maximum.
By compactness, f(K) is compact in R, hence closed and bounded — so supf(K)∈f(K). ■