24 lines
No EOL
654 B
Python
24 lines
No EOL
654 B
Python
#!/usr/bin/env python
|
|
# 2025 - Advent Of Code 3
|
|
|
|
# file = 'input_example.txt'
|
|
file = 'input.txt'
|
|
|
|
joltage_sum = 0
|
|
with open(file, encoding="utf-8") as f:
|
|
for line in f.readlines():
|
|
max = 0
|
|
max2 = 0
|
|
pos_max = 0
|
|
for n in range(0, len(line.strip()) - 1):
|
|
if int(line[n]) > max:
|
|
max = int(line[n])
|
|
pos_max = n
|
|
for n in range(pos_max + 1 , len(line.strip())):
|
|
if int(line[n]) > max2:
|
|
max2 = int(line[n])
|
|
joltage = int(str(max) + str(max2))
|
|
# print(joltage)
|
|
joltage_sum += joltage
|
|
|
|
print(f'Total Joltage: {joltage_sum}') |