Move into 2022 folder

This commit is contained in:
Mark Hoekveen
2024-11-11 09:05:01 +01:00
parent 9dd6a4f275
commit e0d955ec6f
28 changed files with 5 additions and 11 deletions
+11
View File
@@ -0,0 +1,11 @@
count = 0
with open("input.txt", "r") as f:
for line in f.readlines():
line = line.strip("\n")
# Some python magic to split out the strings and convert them to integers
pair = [x.split("-") for x in line.split(",")]
pair = [[int(y) for y in x] for x in pair]
if ((pair[0][0] <= pair[1][0] and pair[0][1] >= pair[1][1]) or
(pair[1][0] <= pair[0][0] and pair[1][1] >= pair[0][1])):
count += 1
print(count)