set for p1

This commit is contained in:
Felix Pankratz 2022-12-04 14:11:33 +01:00
parent 192a9c046e
commit 0d4800e51f

View File

@ -9,10 +9,9 @@ def main():
e1, e2 = line.split(',')
e1_from, e1_to = map(int, e1.split('-'))
e2_from, e2_to = map(int, e2.split('-'))
#r1 = range(int(e1_from), int(e1_to) +1)
#r2 = range(int(e2_from), int(e2_to) +1)
if (e1_from <= e2_from and e1_to >= e2_to ) or \
( e2_from <= e1_from and e2_to >= e1_to ):
r1 = list(range(e1_from, e1_to +1))
r2 = list(range(e2_from, e2_to +1))
if set(r1).issubset(r2) or set(r2).issubset(r1):
includes += 1
print(includes)