Мой код:
with open('17 (4).txt') as f: s = [int(x) for x in f] n = [] for i in range(len(s) - 1): if (s[i] * s[i + 1] % 15 == 0) and (s[i] + s[i + 1] % 7 == 0): n.append(s[i] + s[i + 1]) print(len(n), max(n))
with open('17 (4).txt') as f: s = [int(x) for x in f] n = [] for i in range(len(s) - 1): if (s[i] * s[i + 1] % 15 == 0) and (s[i] + s[i + 1] % 7 == 0): n.append(s[i] + s[i + 1]) print(len(n), max(n))
>>> 12 + 2 % 7 == 0 False >>> (12 + 2) % 7 == 0 True >>>