I'm trying to think of a function that is bounded above and attains a maximum and is bounded below but does not attain a minimum. I have an exam coming up and I'm trying to think of possible scenarios for true or false type questions. I thought this may be a good one but I can't think of an example. The function will be discontinuous but that's as much as I can get. I've been pondering over this for quite a while. Any ideas?
Edit: $\ f:(a,b)\longrightarrow \mathbb{R}$.

$$f(x) = e^{-\left(x-\tfrac{a+b}{2}\right)^2}$$
has a maximum of $1$ at $x=\frac{a+b}{2} \in (a, b)$, but no minimum is attained, though it is bounded below by $0$.
More importantly, this function is not discontinuous. It is in fact very not discontinuous (it is infinitely differentiable).