E( E(X|Y) ) = E(X)
This is known as "the law of total expectation", and as a programmer this notation is so weakly typed it makes no sense. The more correct notation is
E_Y(E_X(X|Y))
If you can see that the outer E is summing over Y and the inner one over X, then the theorem is immediately clearer and very intuitive.
> Definition: The probability mass function (pmf) of a discrete random variable is the function p(a)=P(X=a).
This only makes sense if you already know what the definition is.