I need to write a function that takes in a 2D list, that is a NEARLY magic square, meaning that if you perform ONE swap, it becomes a magic square. The function would take in this nearly magic square, and would return the magic square after the values have been swapped.
I wrote an "isMagic" function already that loops through the sums of the columns and rows, but am having difficulty reasoning through this MAKEMAGICSQUARE function.
So I know that makeMagic([[4,9,1],[3,5,7],[8,2,6]]) would return [[4,9,2],[3,5,7],[8,1,6]].
Also, IMPORTANT REFERENCE http://en.wikipedia.org/wiki/Magic_square.