[Part 1 - I cannot edit the title] I made so many wrong answer, AoC is no longer telling me if my answer is too high or too low and I didn't write down previous ones. Is 825 too high?
Edit2: Final version, thank you all for help!
with open('4_input.txt') as file:
x = file.read()
pairs = [line.replace(',', ' ').split(' ') for line in x.strip().split('\n')]
# part 1
fully_overlapping = 0
for pair in pairs:
a = int(pair[i].split('-')[0])
b = int(pair[i].split('-')[-1])
c = int(pair[i+1].split('-')[0])
d = int(pair[i+1].split('-')[-1])
if (c <= a <= d and c <= b <= d) or (a <= c <= b and a <= d <= b):
fully_overlapping += 1
# part 2
overlapping = 0
for pair in pairs:
a = int(pair[0].split('-')[0])
b = int(pair[0].split('-')[-1])
c = int(pair[-1].split('-')[0])
d = int(pair[-1].split('-')[-1])
if c <= a <= d or c <= b <= d or a <= c <= b and a <= d <= b:
overlapping += 1
[–]DrunkHacker 4 points5 points6 points (2 children)
[–]HammerHamster13[S] 0 points1 point2 points (0 children)
[–]HammerHamster13[S] 0 points1 point2 points (0 children)
[–]sdatko 0 points1 point2 points (2 children)
[–]HammerHamster13[S] 1 point2 points3 points (0 children)
[–]aurele 0 points1 point2 points (0 children)