If I understand correctly, the program only needs to find a pair of prime numbers, so surely you multiply the average (n) by 2, then find all pairs of integers which sum to it, then check if both are primes.
A brute force solution for checking for primes in python is:
def is_prime(n):
if n==1 or n==0:
return False
for i in range(3,n):
if n%i==0:
return False
return True
Other faster solutions and this one can be found here.
Finding pairs of integers that sum to the average times 2 can be done through brute force (this returns each pair twice however):
def sums(n):
return [[x,n-x] for x in range(1,n)]
Putting it all together, using these two functions:
def f(n):
for a in sums(n*2):
if is_prime(a[0]) and is_prime(a[1]):
return a
return 'None found'
Hope this is helpful.