My question is how to get each matrix's average and write it in a new text file.

If contents of text is 

```
1 -20 -100 50 60
3 4 -100 -3 
-10 5 45 10 -15\n

```

I want to get result like this without using numpy:

> 
> 
> ```
> 1 -20 -100 50 60  avg : -2
> 3 4 -100 -3 0     avg : -20
> -10 5 45 10 -15   avg : 7
> -2 -4 -52 19 15
> 
> ```
> 
> 

Here is my code:

```
with open('number.txt','r') as file1:
    file2 = open('text2.txt','w')
    line = file1.readlines()
    for i in range(len(line)):
        a = str(line[i])
        a.split()
        b = a.split()
        for j in range(len(b)):
            sum(int(b[0][i]))/len(b)
        for z in range(len(b)):
            sum(int(b[i][0]))/len(b) 

```