file = open("presenze.txt", "r") presenze = dict() for i in file: i = i.split("f") presenza = dict() presenza["number"] = i[1] presenza["start"] = int(i[2]) presenza["end"] = int(i[3]) presenze[i[0]] = presenza file.close() file = open("sospetti.txt", "r") for sospetto in file: sospetto = sospetto.strip() if sospetto not in presenze: continue inizio = presenze[sospetto]["start"] fine = presenze[sospetto]["end"] notFound = True print("** Contatti del cliente :", sospetto, "**") for nome in presenze: if nome == sospetto: continue if min(fine, presenze[nome]["end"]) - max(inizio, presenze[nome]["start"]) > 0: notFound = False print("\tContatto con "+ nome + ", telefono "+presenze[nome]["number"]) if notFound: print("\tll cliente", sospetto, "non ha avuto contatti") file.close()