mirror of
https://github.com/Xevion/advent-of-code.git
synced 2025-12-07 22:06:20 -06:00
day 1 and day 2 edits, day 1 part 2
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user