You are viewing a single comment's thread. Return to all comments →
Thx, dude! Nice approach! I did it before using array to store a literal matrix, but after reading it and the comments bellow, y'all convinced me to make it without storing data into arrays. Doing this way was a bit challenging using python, cause im not quite acquainted with the language, yet. But it worked. Thx!
And yes, it's better not to store data in arrays if you won't use it later.
Ah, your "(j+k == (numInputs-1)" condition is very nice. I was using "j == (numInputs-1)-k and k == (numInputs-1)-j". Your logical solution for this condition is much better than mine. Thanks for this learning too.
print(abs(sum([a[i][i] - a[i][n-i-1] for i in range(n)])))