#!/usr/bin/python3 expenses = [] with open("input") as fh: for ln in fh: expenses.append(int(ln)) for i in range(len(expenses)): for j in range(i + 1, len(expenses)): if expenses[i] + expenses[j] == 2020: print(expenses[i], expenses[j], "sum = ", expenses[i] + expenses[j], "mul = ", expenses[i] * expenses[j])