I am trying to create a matrix transpose function for python but I can\'t seem to make it work. Say I have
theArray = [[\'a\',\'b\',\'c\'],[\'d\',\'e\',\'f\
Python 2:
>>> theArray = [['a','b','c'],['d','e','f'],['g','h','i']] >>> zip(*theArray) [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')]
Python 3:
>>> [*zip(*theArray)] [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')]