Skip to content

Commit

Permalink
[Python/2017] Move solutions into .py files
Browse files Browse the repository at this point in the history
  • Loading branch information
Defelo committed Oct 29, 2023
1 parent fbc5fda commit 7b1efc0
Show file tree
Hide file tree
Showing 51 changed files with 1,100 additions and 4,546 deletions.
149 changes: 0 additions & 149 deletions Python/2017/01.ipynb

This file was deleted.

10 changes: 10 additions & 0 deletions Python/2017/01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from lib import *

input = read_input(2017, 1).strip()


print(sum(int(a) for a, b in zip(input, input[1:] + input[0]) if a == b))


n = len(input) // 2
print(sum(int(a) for a, b in zip(input, input[n:] + input[:n]) if a == b))
162 changes: 0 additions & 162 deletions Python/2017/02.ipynb

This file was deleted.

27 changes: 27 additions & 0 deletions Python/2017/02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from lib import *

input = read_input(2017, 2)

lines = input.splitlines()


s = 0
for line in lines:
nums = [*map(int, line.split())]
s += max(nums) - min(nums)
print(s)


s = 0
for line in lines:
nums = [*map(int, line.split())]
for a in nums:
for b in nums:
if a % b == 0 and a != b:
s += a // b
break
else:
continue
break

print(s)
Loading

0 comments on commit 7b1efc0

Please sign in to comment.