Let's break it down piece-by-piece so you see what it happening.
a[::-1] is reversing the array so the array now looks like this.
a = [ [7,8,9], [4,5,6], [1,2,3] ]
Not to interesting so far. The magic occurs when you use the zip()
function to convert those arrays into tuples. Now your array looks
like this.
a = [ ([7,8,9],), ([4,5,6],), ([1,2,3],) ]
Well now it looks confusing. What's going on? Why are all those
extra commas there? Those extra commas are there because the
zip() function created tuples out of each row of the array. This
still doesn't get the answer you're look for though. The * is a
special character for the zip() function that says to create a new
tuple from the lists provided
a[:] = zip( *a[::-1])
which returns your answer.
a = [ (7,4,1), (8,5,2), (9,6,1) ]
Please note the difference in the format of the answer. The input was in the form of a two-dimensional array, however the answer is in the form of a one-dimensional array containing tuples. It's an important distinction that you should be aware of.