CseWay
A Way For Learning
Program to Transpose a Matrix in Python
# Program to transpose matrices
x = [[12,7,3],
[4 ,5,6],
[7 ,8,9]]
finalMat=[]
for i in range(len(x[0])):
eachList=[]
for j in range(len(x)):
ag=x[j][i]
eachList.append(ag)
finalMat.append(eachList)
for k in finalMat:
print(k)
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment