Premium problem102. Expected Value and Variance of a Game

Medium Locked

A game has outcomes with the given probabilities and matching payouts. Return (expected_value, variance).

E=∑ipixi,Var=∑ipixi2−E2E = \sum_i p_i x_i, \qquad \mathrm{Var} = \sum_i p_i x_i^2 - E^2

Input

probabilities = [0.5, 0.5]
payouts = [1.0, -1.0]

Output

(0.0, 1.0)

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)