I read E[X]=0*P(X=0)+1*P(X=1)=P(X=1) is the expected value of a binary random variable. But also that E[X]=np when talking about X~B(n, p).
Why is it that they do not compute the same thing if both are talking about a binary variable? Or what am I missing out? Thanks in advance!