Calculating Expected Value In Python