~noelle/aoc-2021

de67d070942f2d1d6ec92d4347950f5852537c9e — Noelle Leigh 2 years ago 5d35d8f
08_1: black format
1 files changed, 6 insertions(+), 2 deletions(-)

M 08/puzzle_1.py
M 08/puzzle_1.py => 08/puzzle_1.py +6 -2
@@ 8,10 8,14 @@ import sys
if __name__ == "__main__":
    digit_count = 0
    for line in sys.stdin:
        signal_patterns, output_value = map(lambda data: data.split(), line.split("|", 1))
        signal_patterns, output_value = map(
            lambda data: data.split(), line.split("|", 1)
        )
        segment_counts = map(lambda digit: len(digit), output_value)
        #                1  4  7  8
        target_digits = (2, 4, 3, 7)
        target_digits_in_value = sum(map(lambda count: 1 if count in target_digits else 0, segment_counts))
        target_digits_in_value = sum(
            map(lambda count: 1 if count in target_digits else 0, segment_counts)
        )
        digit_count += target_digits_in_value
    sys.stdout.write(str(digit_count))