This commit is contained in:
2024-12-01 11:15:16 +01:00
commit 4620bfb9ef
3 changed files with 1050 additions and 0 deletions

28
01/01-01.py Normal file
View File

@@ -0,0 +1,28 @@
#!/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}')

22
01/01-02.py Normal file
View File

@@ -0,0 +1,22 @@
#!/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)
list_similarity = 0
for i in range(len(left)):
list_similarity += right.count(left[i]) * left[i]
print(f'List-Similarity: {list_similarity}')

1000
01/input.txt Normal file

File diff suppressed because it is too large Load Diff