How to prove for any real-valued function , it assumes at least one local maximum and at least one local minimum on any , ?
You can't, it's not true. For example, if for x not equal to 0 or 1, f(0)= f(1)= 0, then f does NOT assume maximum or minimum values on [0, 1].
What is true is that any continuous function assumes a maximum and minimum on a closed and bounded interval.
The standard proof is a very complicated and involves showing that a continuous function maps a closed and bounded interval into a closed and bounded interval.
That function does have global maxima at the endpoints and a local one at 1/2 (but no local minimum). But the statement is still false unless continuity is assumed. You could do something like set f(x)=0 if x is irrational, and for rational numbers let f(n/d)=d if d is even and -d if d is odd.
Once you assume continuity it's true, as HalsofIvy pointed out. Have you seen compactness yet? That's the best way to think about it, if you're allowed to use it.