f | def LookSay(): | f | def LookSay(): |
n | | n | current_values = '1' |
| | | next_values = '' |
| s = 1 | | s = 1 |
n | prev_str = '1' | n | |
| new_str = '' | | |
| while True: | | while True: |
n | x = prev_str + ' ' | n | x = current_values + ' ' |
| for i in prev_str: | | for i in current_values: |
| 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 | new_str += str(s) + str(x[i]) | n | next_values += str(s) + str(x[i]) |
| s = 1 | | s = 1 |
t | prev_str = new_str | t | current_values = next_values |
| new_str = '' | | next_values = '' |
| s = 1 | | s = 1 |