Hi My task is to count difference between max and min value in each lines from .txt file then sum all these values. I've done the first part(the code below) but I don't know how best is it to sum all these values(I tried many ways).

I'll be grateful for help

I'll be grateful for help

filepath = 'rows.txt' with open(filepath) as fp: line = [int(num) for num in fp.readline().split()] cnt = 1 while line: x=max(line)-min(line) print("The difference between max-min value in line",cnt,"is :",x) cnt += 1 #print(sum(x)) #print(cnt) line = [int(num) for num in fp.readline().split()]The result of this code:

```
Output:The difference between max-min value in line 1 is : 2574
The difference between max-min value in line 2 is : 1088
The difference between max-min value in line 3 is : 1215
The difference between max-min value in line 4 is : 3852
The difference between max-min value in line 5 is : 1222
The difference between max-min value in line 6 is : 4324
The difference between max-min value in line 7 is : 1121
The difference between max-min value in line 8 is : 2465
The difference between max-min value in line 9 is : 2956
The difference between max-min value in line 10 is : 169
The difference between max-min value in line 11 is : 4644
The difference between max-min value in line 12 is : 992
The difference between max-min value in line 13 is : 1655
The difference between max-min value in line 14 is : 1422
The difference between max-min value in line 15 is : 1659
The difference between max-min value in line 16 is : 662
```