Corruption Checksum — Python — #adventofcode Day 2
Today’s challenge is to calculate a rather contrived “checksum” over a grid of numbers.
!!! commentary Today I went back to plain Python, and I didn’t do formal tests because only one test case was given for each part of the problem. I just got stuck in.
I did write part 2 out in as nested `for` loops as an intermediate step to working out the generator expression. I think that expanded version may have been more readable.
Having got that far, I couldn't then work out how to finally eliminate the need for an auxiliary function entirely without either sorting the same elements multiple times or sorting each row as it's read.
First we read in the input, split it and convert it to numbers. fileinput.input()
returns an iterator over the lines in all the files passed as command-line arguments, or over standard input if no files are given.