Skip to main content

Section E.1 Expected Value

We can write a function to compute the expected value of a wager.
Listing E.1.1. Python Code
def expected_value(p, wager, payout):
    return p * payout - (1-p) * wager
If the Patriots actually have a 25% chance of winning, the first wager has negative expected value—so you probably don’t want to make it.
Listing E.1.2. Python Code
$ expected_value(p=0.25, wager=100, payout=195)
-26.25
Now let’s compute the expected value of the second wager—assuming the Seahawks have a 75% chance of winning:
Listing E.1.3. Python Code
$ expected_value(p=0.75, wager=240, payout=100)
15.0
The expected value of this wager is positive, so you might want to make it—but only if you have good reason to think the Seahawks have a 75% chance of winning.