Browse Source

Day 1a

main
Noëlle 3 years ago
commit
7696ded209
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      day1a.py

+ 22
- 0
day1a.py View File

@@ -0,0 +1,22 @@
def comp(a, nums):
for el in nums:
if a + el == 2020:
return el
return False

def main():
with open("input1a.txt") as file:
lines = file.readlines()
lines = [int(line.strip()) for line in lines]
cur = -1
a, b = -1, -1
while len(lines) > 0:
a = lines.pop()
c = comp(a, lines)
if c:
b = c
break
print(f"{a} * {b} = {a*b}")

if __name__ == "__main__":
main()

Loading…
Cancel
Save