We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1af308 commit 7347d12Copy full SHA for 7347d12
BasicThings/addmatrix.py
@@ -0,0 +1,34 @@
1
+rows = int(input("Enter the number of rows : "))
2
+col = int(input("Enter the number of col : "))
3
+
4
5
+def take_input():
6
+ mat = []
7
+ for r in range(rows):
8
+ temp = []
9
+ for c in range(col):
10
+ temp.append(int(input("Enter the value at index[{}{}] : ".format(r + 1, c + 1))))
11
+ mat.append(temp)
12
+ return mat
13
14
15
+print("Enter Values of Matrix 1")
16
+mat1 = take_input()
17
+print("Enter Values of matrix 2")
18
+mat2 = take_input()
19
20
21
+def add_matrix(m, m2):
22
23
24
25
26
+ temp.append(m[r][c] + m2[r][c])
27
28
29
30
31
+res = add_matrix(mat1, mat2)
32
+for i in res:
33
+ print(*i)
34
0 commit comments