Created
December 3, 2024 02:30
-
-
Save tonytx05/1fe0bfd2e5e458c51a95c2b9b89c9b37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Description: Advent of Code 2024 day 1 puzzle 2 | |
Author: Anthony Allison | |
Date Created: 2 December 2024 | |
Date Modified: 2 December 2024 | |
Version: 1.0 | |
""" | |
import pandas as pd | |
widths = [5, 8] | |
df = pd.read_fwf('input.txt', widths=widths, header=None) | |
score = 0 | |
for row in df.iterrows(): | |
matches = df[0].size-df[1].eq(row[1][0]).value_counts()[False] | |
score = score + matches * row[1][0] | |
print(score) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment