You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
333 B
Python

2 years ago
#!/usr/bin/env python3
from itertools import permutations
with open('input', 'r') as f:
content = list(map(int, (map(str.strip, f.readlines()))))
perms = permutations(content, 2)
for perm in perms:
perm_sum = perm[0] + perm[1]
if perm_sum == 2020:
print('{} * {} = {}'.format(perm[0], perm[1], perm[0]*perm[1]))