X = [[2,7],
[4 ,5],]
res = [[0,0],
[0,0]]
for i in range(len(X)):
for j in range(len(X):
res[j][i] = X[i][j]
for r in res:
print(r)
Algorithm :
- Declare two matrix one with values and other to store the result
- Use 2 for loops to define rows and columns
- Replace row with columns and store them in the result variable
- Finally print the result
Comments :