Didn't realize CodeEval just wanted us to print the results, not write them back to a file. Code complete; comments added