import collections dice_throw = collections.defaultdict(list) for i in range(1, 7): for j in range(1,7): dice_throw[i+j].append((i,j)) dice_throw