Files
aoc/2025/05/part1.py
2025-12-05 17:28:17 +01:00

28 lines
547 B
Python

import os
if (os.path.isfile("./input")):
input = open("./input", "r").read()
else:
input = "3-5\n10-14\n16-20\n12-18\n\n1\n5\n8\n11\n17\n32\n"
input = input[:-1]
isList = True
fresh = []
c = 0
for line in input.split('\n'):
if (line == ""):
isList = False
continue
if (isList):
fresh.append([int(line.split('-')[0]), int(line.split('-')[1])])
if (not isList):
for f in fresh:
if (int(line) >= f[0] and int(line) <= f[1]):
c += 1
break
print(c)