14 lines
318 B
Python
14 lines
318 B
Python
|
values = []
|
||
|
with open('data', 'r') as fp:
|
||
|
values = fp.readline().strip().split(',')
|
||
|
for i in range(0, len(values)):
|
||
|
values[i] = int(values[i])
|
||
|
values.sort()
|
||
|
|
||
|
index = int(len(values) / 2)
|
||
|
total = 0
|
||
|
for i in range(0, len(values)):
|
||
|
if(i != index):
|
||
|
total += abs(values[i] - values[index])
|
||
|
print(total)
|