advent_of_code/2025/1/1.py
kleph 18ad109e33
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2025 - Day 1 part 1
2025-12-01 23:56:36 +01:00

24 lines
No EOL
569 B
Python

#!/usr/bin/env python
# 2025 - Advent Of Code 1
# file = 'input_example.txt'
file = 'input.txt'
dial = 50
count = 0
with open(file, encoding="utf-8") as f:
for line in f.readlines():
direction = line[0]
distance = int(line[1:])
# print(f'{direction=}, {distance=}')
if direction == 'L':
dial -= distance
print(f'Left {dial=}')
elif direction == 'R':
dial += distance
print(f'Right {dial=}')
dial = dial % 100
if dial == 0:
count += 1
print(count)