Ver código fonte

Simplify slightly.

master
Chris Smith 6 anos atrás
pai
commit
bc922910b3
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3
    3
      01.py

+ 3
- 3
01.py Ver arquivo

@@ -7,6 +7,6 @@ with open('data/01.txt', 'r') as file:
7 7
 # Alternatively...
8 8
 import numpy as np
9 9
 with open('data/01.txt', 'r') as file:
10
-    captcha = file.readline().strip()
11
-    print('Part one: %s' % sum(int(i) for i, j in zip(captcha, np.roll(list(captcha), 1).tolist()) if i == j))
12
-    print('Part two: %s' % sum(int(i) for i, j in zip(captcha, np.roll(list(captcha), len(captcha)//2).tolist()) if i == j))
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))

Carregando…
Cancelar
Salvar