f | def LookSay(): | f | def LookSay(): |
n | current_values = '1' | n | |
| next_values = '' | | |
| s = 1 | | s = 1 |
n | | n | prev_str = '1' |
| | | new_str = '' |
| while True: | | while True: |
n | x = current_values + ' ' | n | x = prev_str + ' ' |
| for i in current_values: | | for i in prev_str: |
| yield int(i) | | yield int(i) |
| for i in range(len(x) - 1): | | for i in range(len(x) - 1): |
| if x[i] == x[i + 1]: | | if x[i] == x[i + 1]: |
| s += 1 | | s += 1 |
| else: | | else: |
n | next_values += str(s) + str(x[i]) | n | new_str += str(s) + str(x[i]) |
| s = 1 | | s = 1 |
t | current_values = next_values | t | prev_str = new_str |
| next_values = '' | | new_str = '' |
| s = 1 | | s = 1 |