The expected value is the long-run average of a random variable — each outcome weighted by how often it happens:
E[X] = Σ value * probability
Task: write expected_value(values, probabilities) returning E[X], rounded to 4 decimal places.
values[i] occurs with probability probabilities[i].Worth noticing that the expected value need not be an outcome you can ever observe. A fair die averages 3.5, a number that isn't on any face — it describes the distribution, not any single roll.