Q:

print an array with all the possible mean

Suppose I have a list 'a'. Now, I want to print a list with all the possible mean(only integers) from all the possible pairs of list 'a'.For example:
     a = [0,0,3,4,1,2,9]

Now, I want to print a list b such that;
     b = [0,2,1,2,1,2,6,3,5]

If (a,b) is taken as a pair then (b,a) wont count. But it would count if there are duplicates of a and b present.

A:

You could use itertools.combinations():
import itertools
a = [0,0,3,4,1,2,9]  
av = [int(sum(i)/2) for i in itertools.combinations(a, 2) if sum(i)%2 == 0]

Output:
[0, 2, 1, 2, 1, 2, 6, 3, 5]

