You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122
  1. def comp(a, nums):
  2. for el in nums:
  3. if a + el == 2020:
  4. return el
  5. return False
  6. def main():
  7. with open("input1a.txt") as file:
  8. lines = file.readlines()
  9. lines = [int(line.strip()) for line in lines]
  10. cur = -1
  11. a, b = -1, -1
  12. while len(lines) > 0:
  13. a = lines.pop()
  14. c = comp(a, lines)
  15. if c:
  16. b = c
  17. break
  18. print(f"{a} * {b} = {a*b}")
  19. if __name__ == "__main__":
  20. main()