Python program to add two Matrices

 Python program to add two Matrices


# Program to add two matrices using nested loop

Code:

X = [[10,2,3],
[4 ,2,0],
[7 ,6,12]]

Y = [[8,9,7],
[0,5,4],
[38,67,2]]


result = [[0,0,0],
[0,0,0],
[0,0,0]]

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

for r in result:
print(r)



Output:

For more follow on Instragram: Code Champ

Draw Shin Chan using Python Turtle: https://youtu.be/JqS5NJV2chk
Draw Doremon using Turtle in python : https://youtu.be/mfPfSERU2K0
Print name using Python Turtle: https://youtu.be/5XcSBJqQMIc
Indian Flag using Python Turtle: https://youtu.be/XSulTcyWAoE
Amazing Design/ pattern using Python Turtle: https://youtu.be/fIYzTIjJdT4 
Amazing 2Design/ pattern using Python Turtle:  https://youtu.be/5gX09uVdjlo

Difference  between C++ and Java: https://youtu.be/oSLL27bIXKQ

Types of application in java: https://www.instagram.com/p/CUIBrSmv6LM/


python programs
python programming
python if else
python examples

For Flipkart and Amazon best deals visit:

    No comments:

    Powered by Blogger.