1
0
Fork 0

Here we go again

This commit is contained in:
Lucidiot 2018-12-01 12:12:02 +01:00
parent 9bfa5ac661
commit 968a9786a8
No known key found for this signature in database
GPG Key ID: AE3F7205692FA205
2 changed files with 21 additions and 0 deletions

3
2018/1/part1.py Executable file
View File

@ -0,0 +1,3 @@
import fileinput
print(eval(''.join(map(str.strip, fileinput.input()))))

18
2018/1/part2.py Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
import fileinput
import itertools
def main():
x = 0
found = {x}
for line in itertools.cycle(map(str.strip, fileinput.input())):
x = eval('x{}'.format(line))
if x in found:
return x
found.add(x)
if __name__ == '__main__':
print(main())