```
def find_sums(num_dice, num_faces):
""" Given the number of dice with a given number of faces (numbered 1...num_faces),
returns a dictionary mapping all the obtainable sums (elementary events) to the number of ways to
get the sum for one throw of the dice. """
# first die
sums = dict([(i, 1) for i in range(1, num_faces + 1)])
# rest of the dice
for die in range(2, num_dice + 1):
new_sums = {}
# take each existing sum
for (total, count) in sums.items():
# and add each possible die face to it, generating new sums
for face in range(1, num_faces + 1):
temp = total + face # new sum
if temp in new_sums:
new_sums[temp] = new_sums[temp] + count
else:
new_sums[temp] = count
sums = new_sums
return sums
```

About the Author

*Edited 5 Years Ago by pyTony*: n/a

*Edited 5 Years Ago by pyTony*: n/a

*Edited 5 Years Ago by pyTony*: n/a

*Edited 5 Years Ago by pyTony*: n/a

*Edited 5 Years Ago by pyTony*: n/a

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.