| f | def LookSay(): | f | def LookSay(): |
| term = '1' | | term = '1' |
| while True: | | while True: |
| t | for digit in term: | t | for ch in term: |
| yield int(digit) | | yield int(ch) |
| next_term = '' | | next_term = '' |
| count = 1 | | count = 1 |
| for i in range(1, len(term)): | | for i in range(1, len(term)): |
| if term[i] == term[i - 1]: | | if term[i] == term[i - 1]: |
| count += 1 | | count += 1 |
| else: | | else: |
| next_term += str(count) + term[i - 1] | | next_term += str(count) + term[i - 1] |
| count = 1 | | count = 1 |
| next_term += str(count) + term[-1] | | next_term += str(count) + term[-1] |
| term = next_term | | term = next_term |