Files
adventofcode/day-10/solution.py
Bert Peters 7a72d5f5d1 Import print_function
This makes sure that the code still runs in pypy properly.
2015-12-14 00:51:27 +01:00

18 lines
329 B
Python

from __future__ import print_function
import itertools
def lookandsay(line):
return ''.join([str(len(list(it))) + c for c, it in itertools.groupby(line)])
line = "1321131112"
for x in range(40):
line = lookandsay(line)
print("40:", len(line))
for x in range(10):
line = lookandsay(line)
print("50:", len(line))