Pay special attention to the example 1
The average is just a simple addition and average.
Expectation involves probability (probability can be understood as an expectation, but in this case, understanding is beneficial to you)
There is a very simple point to note.
Discretization has an average value.
There are continuous mathematical expectations, but there is no mean.