0

In python 3 to transpose matrix = [[1,2,3], [4,5,6]] we can do zip(*matrix) but this returns an itterable.

So then I did list(zip(*matrix)) but this is a list wrapped around tuples not list of list.

So I used a map to get map(list, zip(*matrix)) which returns a map object not a list of lists like the original

Finally I did list(map(list, zip(*matrix))) which gave me what I want, but surely there is a faster and cleaner way of doing this without NumPy

OnePiece
  • 328
  • 5
  • 17

0 Answers0