28 lines
431 B
Python
28 lines
431 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
input_file = open("input.txt", "r")
|
|
|
|
left = []
|
|
right = []
|
|
|
|
for line in input_file:
|
|
a, b = line.split()
|
|
left.append(int(a))
|
|
right.append(int(b))
|
|
input_file.close()
|
|
|
|
print(left)
|
|
print(right)
|
|
|
|
left.sort()
|
|
right.sort()
|
|
|
|
print(left)
|
|
print(right)
|
|
|
|
list_distance = 0
|
|
for i in range(len(left)):
|
|
list_distance += abs(left[i]-right[i])
|
|
|
|
print(f'List-Distance: {list_distance}') |