2022 4a solved

kwout 11 months ago
parent 2805c3ae78
commit 2f52587ab8
  1. 11
      2022/4.py

@ -0,0 +1,11 @@
pairs = [[[int(n) for n in m.split("-")] for m in l.split(",")] for l in [i for i in open("input.txt", 'r').read().splitlines()]]
sum = 0
for p in pairs:
if p[0][0] <= p[1][0] and p[0][1] >= p[1][1]:
sum += 1
elif p[0][0] >= p[1][0] and p[0][1] <= p[1][1]:
sum += 1
print(sum)
Loading…
Cancel
Save