>>> from itertools import permutations, combinations
>>> l = [5, 6, 7, 0, 3, 1, 7]
# compute average
>>> avg = sum(l)//len(l)
# generate all possible combinations
>>> [i for i in combinations(l, 2)]
[(5, 6), (5, 7), (5, 0), (5, 3), (5, 1), (5, 7), (6, 7), (6, 0), (6, 3), (6, 1), (6, 7), (7, 0), (7, 3), (7, 1), (7, 7), (0, 3), (0, 1), (0, 7), (3, 1), (3, 7), (1, 7)]
>>> [(a+b)//2 for a,b in combinations(l, 2)]
[5, 6, 2, 4, 3, 6, 6, 3, 4, 3, 6, 3, 5, 4, 7, 1, 0, 3, 2, 5, 4]
# only filter those which average to the mean of the whole list
>>> [(a,b) for a,b in combinations(l, 2) if (a+b)//2==avg]
[(5, 3), (6, 3), (7, 1), (1, 7)]