|
@@ -8,5 +8,5 @@ with open('data/01.txt', 'r') as file:
|
8
|
8
|
import numpy as np
|
9
|
9
|
with open('data/01.txt', 'r') as file:
|
10
|
10
|
captcha = list(file.readline().strip())
|
11
|
|
- print('Part one: %s' % sum(int(i) for i, j in zip(captcha, np.roll(captcha, 1).tolist()) if i == j))
|
12
|
|
- print('Part two: %s' % sum(int(i) for i, j in zip(captcha, np.roll(captcha, len(captcha)//2).tolist()) if i == j))
|
|
11
|
+for part, roll in enumerate([1, len(captcha)//2]):
|
|
12
|
+ print('Part %s: %s' % (part + 1, sum(int(i) for i, j in zip(captcha, np.roll(captcha, roll)) if i == j)))
|