Skip to content

Commit

Permalink
[Python/2020] Move solutions into .py files
Browse files Browse the repository at this point in the history
  • Loading branch information
Defelo committed Oct 28, 2023
1 parent 8bb50bc commit 8c2be5f
Show file tree
Hide file tree
Showing 52 changed files with 1,140 additions and 5,916 deletions.
209 changes: 0 additions & 209 deletions Python/2020/01.ipynb

This file was deleted.

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

input = read_input(2020, 1)

nums = ints(input)


seen = set()
for a in nums:
b = 2020 - a
if b in seen:
print(a * b)
break
seen.add(a)


for i, a in enumerate(nums):
seen = set()
for b in nums[i + 1 :]:
c = 2020 - a - b
if c in seen:
print(a * b * c)
break
seen.add(b)
else:
continue
break
Loading

0 comments on commit 8c2be5f

Please sign in to comment.