Files
adventofcode/day-10/solution.py
Bert Peters 6a0c619d74 Reimplement day 10 using itertools combine.
Now it DOES run using pypy, and is faster again.
2015-12-11 12:23:59 +01:00

17 lines
289 B
Python

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)