Noëlle 4 anni fa
commit
7696ded209
1 ha cambiato i file con 22 aggiunte e 0 eliminazioni
  1. 22
    0
      day1a.py

+ 22
- 0
day1a.py Vedi 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…
Annulla
Salva