t | def LookSay(): | t | def LookSay(): |
| output = [1] | | output = [1] |
| while True: | | while True: |
| for item in output: | | for item in output: |
| yield item | | yield item |
| next_output = [] | | next_output = [] |
| count = 1 | | count = 1 |
| for i in range(len(output)): | | for i in range(len(output)): |
| if i < len(output) - 1 and output[i] == output[i + 1]: | | if i < len(output) - 1 and output[i] == output[i + 1]: |
| count += 1 | | count += 1 |
| else: | | else: |
| next_output.extend([count, output[i]]) | | next_output.extend([count, output[i]]) |
| count = 1 | | count = 1 |
| output = next_output | | output = next_output |