A board-game designer is testing homemade dice. Each die is written as the list of numbers printed on its faces, one entry per face. Every face is equally likely to land on top, but the same number may be printed on more than one face. For example, [1, 1, 2] is a three-faced die that shows 1 with probability and 2 with probability . The two dice do not need the same number of faces.
The game rolls both dice and uses their total. Let be that total: a discrete random variable.
Task: write sum_pmf(die_a, die_b) that returns the PMF of , , as a list of (total, probability) tuples:
The two dice are rolled independently. Faces can be any whole numbers, including 0 and negatives, and each die has at least one face.
For instance, two dice that each show [0, 1] give [(0, 0.25), (1, 0.5), (2, 0.25)].