Noëlle 4 anos atrás
commit
7696ded209
1 arquivos alterados com 22 adições e 0 exclusões
  1. 22
    0
      day1a.py

+ 22
- 0
day1a.py Ver arquivo

@@ -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()

Carregando…
Cancelar
Salvar