day 1 and day 2 edits, day 1 part 2

This commit is contained in:
Xevion
2019-07-26 14:10:27 -06:00
parent 86920028d4
commit 17b61b6cd7
2 changed files with 36 additions and 8 deletions

View File

@@ -5,9 +5,20 @@ def count(string):
path = os.path.join(sys.path[0], '..', 'input')
data = open(path, 'r').read().split('\n')
data = sum(map(count, data), [])
two, three = data.count(2), data.count(3)
sums = sum(map(count, data), [])
two, three = sums.count(2), sums.count(3)
answer = two * three
print("{} x {} = {}".format(two, three, answer))
pyperclip.copy(answer)
pyperclip.copy(answer)
try:
for id1 in data:
for id2 in data:
diff = [i for i in range(len(id1)) if id1[i] != id2[i]]
if len(diff) == 1:
e = [id1[i] for i in range(len(id1)) if i not in diff]
print(''.join(e))
raise Exception()
except:
pass