You are given two positive integer lists with a random number of elements (1 <= n <= 100). Create a [GCD](https://en.wikipedia.org/wiki/Greatest_common_divisor) matrix and calculate the average of all values. 

Return a float value rounded to 3 decimal places. 


## Example

```
a = [1, 2, 3]
b = [4, 5, 6]

#       a =    1  2  3     b =
gcd(a, b) = [ [1, 2, 1],   # 4
              [1, 1, 1],   # 5
              [1, 2, 3] ]  # 6

average(gcd(a, b)) = 1.444
```

Difficulty: introductory

Starter code:

def gcd_matrix(a,b):
	

Solutions:
from fractions import gcd
from itertools import product, starmap
from statistics import mean

def gcd_matrix(a, b):
    return round(mean(starmap(gcd, product(a, b))), 3)

from fractions import gcd

def gcd_matrix(a, b):
    return round(sum(gcd(x, y) for x in a for y in b) / (len(a) * len(b)), 3)


from math import gcd

def gcd_matrix(a, b):
    return round(sum(gcd(m, n) for m in a for n in b) / (len(a) * len(b)), 3)

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def gcd_matrix(a,b):
    g=[]
    for i in a:
        for j in b:
            g.append(gcd(i,j))
    
    return round(sum(g)/len(g),3)

from fractions import gcd
def gcd_matrix(a,b):
    l = [gcd(i, j) for j in b for i in a]
    return round(sum(l)/len(l), 3)

from fractions import gcd
from statistics import mean

def gcd_matrix(xs, ys):
    return round(mean(gcd(x, y) for x in xs for y in ys), 3)

gcd_matrix=lambda a,b:round(sum(__import__('fractions').gcd(x,y)for x in a for y in b)/len(a)/len(b),3)

from math import gcd
def gcd_matrix(a,b):
    return round(sum(sum(gcd(i,j) for j in b) for i in a)/(len(a)*len(b)),3)

from math import gcd
def gcd_matrix(a,b):
    k=a[:];p=0
    for i in range(len(b)):
        s=[]
        for j in range(len(a)):
            k[j]=gcd(a[j],b[i])
            s.append(k[j])
        p+=sum(s)
    return round((p/(len(a)*len(b))),3)

def gcd_matrix(a,b):
    def gcd(a2,b2):
        for i in range(min(a2,b2),0,-1):
            if a2 % i == 0 and b2 % i == 0:
                return i
    output = 0
    for i in a:
        for j in b:
            output += gcd(i,j)
    return round(output/(len(a)*len(b)),3)