forked from I-RoshanKumar/Beginner_Hactoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdd_matrix.py
More file actions
47 lines (24 loc) · 658 Bytes
/
Add_matrix.py
File metadata and controls
47 lines (24 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
matOne = []
print("Enter 9 Elements for First Matrix: ")
for i in range(3):
matOne.append([])
for j in range(3):
num = int(input())
matOne[i].append(num)
matTwo = []
print("Enter 9 Elements for Second Matrix: ")
for i in range(3):
matTwo.append([])
for j in range(3):
num = int(input())
matTwo[i].append(num)
matThree = []
for i in range(3):
matThree.append([])
for j in range(3):
matThree[i].append(matOne[i][j]+matTwo[i][j])
print("\nAddition Result of Two Given Matrix is:")
for i in range(3):
for j in range(3):
print(matThree[i][j], end=" ")
print()