Files
AdventOfCode2025/03/03-1.py
2025-12-03 21:16:23 +01:00

27 lines
653 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#file = "./ex.txt"
file = "./input.txt"
def find_num(l:str) -> int:
numbers = "9876543210"
for z1 in numbers:
if z1 in l[:-1]:
start_pos = l.find(z1)+1
for z2 in numbers:
if z2 in l[start_pos:]:
print(f"{z1}{z2}")
return int(f"{z1}{z2}")
return -999999999
if __name__ == "__main__":
solution = 0
input_file = open(file, "r")
for line in input_file:
line = line.strip()
if line == "":
continue
solution += find_num(line)
print(f"Solution: {solution}")