LookSay/Viliana | LookSay/lowerchik | ||||
---|---|---|---|---|---|
t | 1 | from itertools import groupby | t | 1 | from itertools import groupby |
2 | 2 | ||||
3 | def LookSay(): | 3 | def LookSay(): | ||
4 | lst = [1] | 4 | lst = [1] | ||
5 | while True: | 5 | while True: | ||
6 | for num in lst: | 6 | for num in lst: | ||
7 | yield num | 7 | yield num | ||
8 | iter_ = groupby(lst) | 8 | iter_ = groupby(lst) | ||
9 | lst = [] | 9 | lst = [] | ||
10 | for (key, group) in iter_: | 10 | for (key, group) in iter_: | ||
11 | lst.append(len(list(group))) | 11 | lst.append(len(list(group))) | ||
12 | lst.append(key) | 12 | lst.append(key) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|