Advent of Code 2022 day 4

Eliminating side effects from this code could be a fun task.

with open("4.txt") as f:
    lines = f.read().splitlines()

def contains(line):
    l, r = line
    min_l, max_l = l.split("-")
    min_r, max_r = r.split("-")
    print(line, min_l, max_l, min_r, max_r)
    if int(min_l) <= int(min_r) and int(max_l) >= int(max_r):
        return 1
    elif int(min_r) <= int(min_l) and int(max_r) >= int(max_l):
        return 1
    return 0

def in_other(line):
    return contains(line.split(","))

print(sum([in_other(line) for line in lines]))

def overlap(line):
    l, r = line
    min_l, max_l = l.split("-")
    min_r, max_r = r.split("-")
    print(line, min_l, max_l, min_r, max_r)
    if int(min_l) >= int(min_r) and int(min_l) <= int(max_r):
        return 1
    elif int(min_r) >= int(min_l) and int(min_r) <= int(max_l):
        return 1
    return 0

def in_other_2(line):
    return overlap(line.split(","))

print(sum([in_other_2(line) for line in lines]))