LookSay/Emets_E_S | LookSay/sukhodoeva_ae | ||||
---|---|---|---|---|---|
f | 1 | from itertools import groupby | f | 1 | from itertools import groupby |
2 | 2 | ||||
3 | def LookSay(): | 3 | def LookSay(): | ||
n | 4 | seq = [1] | n | 4 | n = [1] |
5 | while True: | 5 | while True: | ||
n | 6 | for i in seq: | n | 6 | for i in n: |
7 | yield i | 7 | yield i | ||
t | 8 | tmp = [] | t | 8 | q = [] |
9 | for (i, j) in groupby(seq): | 9 | for (k, g) in groupby(n): | ||
10 | tmp.append(len(list(j))) | 10 | q.append(len(list(g))) | ||
11 | tmp.append(i) | 11 | q.append(k) | ||
12 | seq = tmp | 12 | n = q |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|