You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
463 B

10 months ago
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
10 months ago
sum2 = 0
10 months ago
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
10 months ago
if p[0][0] <= p[1][1] and p[0][1] >= p[1][0]:
sum2 += 1
elif p[1][0] <= p[0][1] and p[1][1] >= p[0][0]:
sum2 += 1
print(sum)
print(sum2)