first commit

This commit is contained in:
Peter Hudec
2018-12-13 19:09:30 +01:00
commit 9f3e899cda
9 changed files with 2750 additions and 0 deletions
+1024
View File
File diff suppressed because it is too large Load Diff
Executable
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env python
start = 0
with open('input.txt', 'r') as f:
for line in f:
start += int(line)
print(start)
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/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)