| def comp(a, nums): | |||||
| for el in nums: | |||||
| if a + el == 2020: | |||||
| return el | |||||
| return False | |||||
| def main(): | |||||
| with open("input1a.txt") as file: | |||||
| lines = file.readlines() | |||||
| lines = [int(line.strip()) for line in lines] | |||||
| cur = -1 | |||||
| a, b = -1, -1 | |||||
| while len(lines) > 0: | |||||
| a = lines.pop() | |||||
| c = comp(a, lines) | |||||
| if c: | |||||
| b = c | |||||
| break | |||||
| print(f"{a} * {b} = {a*b}") | |||||
| if __name__ == "__main__": | |||||
| main() |