Events and Probability Spaces · Events and Probability Spaces
Lesson 10
Now the outcomes are the sequences of three numbers from 1 to 6. One may enumerate those that have the required property.
from itertools import product
outcomes = list(product(range(1, 7), repeat=3))
good_outcomes = [u for u in outcomes if sum(u) % 2 == 0]
print(len(good_outcomes) / len(outcomes))0.5
We may also use symmetry considerations (or the bijection rule): for each pair of numbers rolled on two fixed dice, in exactly half of all remaining cases, the sum will be even.