From 3b046c3a52fd3a1a768b02248026cf2c6800f6a3 Mon Sep 17 00:00:00 2001 From: Prathima Kadari Date: Wed, 19 May 2021 21:22:39 +0530 Subject: [PATCH] Added transpose matrix program --- transposematrix.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 transposematrix.py diff --git a/transposematrix.py b/transposematrix.py new file mode 100644 index 0000000..cb74466 --- /dev/null +++ b/transposematrix.py @@ -0,0 +1,17 @@ +#Transpose of a Matrix + +def matrixTranspose(): + dim = int(raw_input("Enter the dimension of the matrix: ")) + array_input =[[0 for i in range(0,dim)]for j in range(0,dim)] + array_output=[[0 for i in range(0,dim)]for j in range(0,dim)] + + for i in range(0,dim): + for j in range(0,dim): + array_input[i][j] = int(raw_input("Enter an element:")) + print array_input + + for i in range(0,dim): + for j in range(0,dim): + array_output[i][j] = array_input[j][i] + + print array_output