#!/usr/bin/env python3 # -*- coding: utf-8 -*- data = [] # parse input input_file = open("input", "r") for line in input_file: line = line.strip() line = line.replace(",", "-").split("-") tt = [] for t in line: tt.append(int(t)) data.append(tt) input_file.close() c = 0 def a_overlaps_b(a1, a2, b1, b2): if a2 >= b1 and a1 <= b2: global c c += 1 print(a1, a2, b1, b2) return True return False counter = 0 for d in data: if a_overlaps_b(d[0], d[1], d[2], d[3]) or a_overlaps_b(d[2], d[3], d[0], d[1]): # print(d) counter += 1 print("Lösung:", counter) print(c)