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