Skip to content

Commit 7aa9361

Browse files
Merge pull request raviprakashdev#71 from melonwall/patch-1
Transpose Matrix
2 parents 0856d74 + e48a453 commit 7aa9361

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Transpose_Matrix.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
rows = int(input("Enter the Number of rows : " ))
2+
column = int(input("Enter the Number of Columns: "))
3+
4+
print("Enter the elements of Matrix:")
5+
matrix= [[int(input()) for i in range(column)] for i in range(rows)]
6+
print("Matrix")
7+
for n in matrix:
8+
print(n)
9+
10+
11+
result =[[0 for i in range(rows)] for j in range(column)]
12+
13+
for r in range(rows):
14+
for c in range(column):
15+
result[c][r] = matrix[r][c]
16+
17+
print("Transpose matrix is: ")
18+
for r in result:
19+
print(r)

0 commit comments

Comments
 (0)