first commit

This commit is contained in:
2020-12-02 12:34:15 +01:00
parent e7158639f6
commit f4c3aeabee
13 changed files with 1421 additions and 0 deletions

24
2017/alt1.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python
myfile = open('input.txt', 'r')
contents = myfile.read()
myfile.close()
contents = contents.strip()
part_one = 0
part_two = 0
for i in range(len(contents) - 1):
if contents[i] == contents[i + 1]:
part_one += int(contents[i])
if contents[-1] == contents[0]:
part_one += int(contents[-1])
for i in range(len(contents)):
if contents[i] == contents[int(i + len(contents) / 2) % len(contents)]:
part_two += int(contents[i])
print("Part One:", part_one)
print("Part Two:", part_two)