How can i zip all the values for a particular coloumn in a matrix? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i zip all the values for a particular coloumn in a matrix?

For ex: 1 0 0 1 0 5 0 5 2 0 3 3 Op should be: [[1,0,2],[0,5,0],[0,0,3],[1,5,3]]

29th Jun 2021, 8:16 AM
RuntimeERROR
RuntimeERROR - avatar
4 Answers
+ 5
So, you basically want to transpose the matrix using zip() https://code.sololearn.com/cA23a12a98A1/?ref=app
29th Jun 2021, 8:31 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
ChaoticDawg ... very cool! Just as alternative and less cool: https://code.sololearn.com/cZF76ixI1B5f/?ref=app
29th Jun 2021, 9:25 AM
Oma Falk
Oma Falk - avatar
+ 2
Lothar supposed to transpose a matrix not flatten, but still 👍👍
29th Jun 2021, 11:39 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Both of u were very cool😁
29th Jun 2021, 9:49 AM
RuntimeERROR
RuntimeERROR - avatar