Skip to content

Commit

Permalink
Created a python Program to add 2 matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
bhanuteja2001 authored Oct 17, 2020
1 parent ac49cd5 commit 1898793
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions AddMatrices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Program to add two matrices using list comprehension

X = [[12,7,3],
[4 ,5,6],
[7 ,8,9]]

Y = [[5,8,1],
[6,7,3],
[4,5,9]]

result = [[X[i][j] + Y[i][j] for j in range(len(X[0]))] for i in range(len(X))]

for r in result:
print(r)

0 comments on commit 1898793

Please sign in to comment.