Created
April 30, 2022 20:12
-
-
Save Mu-adventofcode/c07a7d4f55e3d2510eafa8b025c403f7 to your computer and use it in GitHub Desktop.
Advent of Code 2021 day 08 part 1
This file contains hidden or 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
from collections import Counter | |
with open("input.txt") as txt: | |
output_values = [line.split(" | ")[1].strip() for line in txt] | |
digit_lengths = [len(d) for val in output_values for d in val.split()] | |
counts = Counter(digit_lengths) | |
total = sum(counts[i] for i in (2, 4, 3, 7)) # lens of digits 1, 4, 7 resp 8 | |
print(total) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment