20 lines
352 B
Python
20 lines
352 B
Python
![]() |
#!/usr/bin/env python
|
||
|
|
||
|
start = 0
|
||
|
seen = [0]
|
||
|
|
||
|
def get_freq_change():
|
||
|
while True:
|
||
|
print('reading file from start')
|
||
|
with open('input.txt', 'r') as f:
|
||
|
for line in f:
|
||
|
yield int(line)
|
||
|
|
||
|
for change in get_freq_change():
|
||
|
start += change
|
||
|
if start in seen:
|
||
|
break
|
||
|
seen.append(start)
|
||
|
|
||
|
print(start)
|