1
0
Fork 0

Puzzle du 10 décembre 2015

This commit is contained in:
Lucidiot 2017-12-17 18:57:12 +01:00
parent 960ef10877
commit 87ed25ca64
No known key found for this signature in database
GPG Key ID: 63BD9482C29D0F64
1 changed files with 18 additions and 0 deletions

18
2015/10/elves.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
import sys
number = sys.argv[1]
def gen_number(num):
current, count, output = num[0], 1, ''
for digit in num[1:]:
if digit != current:
output += str(count) + current
current, count = digit, 1
else:
count += 1
output += str(count) + current
return output
for _ in range(int(sys.argv[2])):
number = gen_number(number)
print(len(number))