ELISHA1234523
ELISHA1234523 ELISHA1234523
  • 07-08-2021
  • Computers and Technology
contestada

write a program in python to add two matrices...... ​

Respuesta :

belongtoinsarifamily
belongtoinsarifamily belongtoinsarifamily
  • 16-08-2021

Answer:

# Program to add two matrices using nested loop

X = [[12,7,3],

   [4 ,5,6],

   [7 ,8,9]]

Y = [[5,8,1],

   [6,7,3],

   [4,5,9]]

result = [[0,0,0],

        [0,0,0],

        [0,0,0]]

# iterate through rows

for i in range(len(X)):

  # iterate through columns

  for j in range(len(X[0])):

      result[i][j] = X[i][j] + Y[i][j]

for r in result:

  print(r)

Answer Link

Otras preguntas

What is four fifths of 320 square feet
how do flukes breathe? (respiration)
What is the tense of the underlined verb in the sentence? We had just begun to practice the skit when the fire alarm rang.
Factoring with two variables 6w^4-54w^2
During a rainstorm, when soil becomes saturated, the amount of infiltration(1) decreases and runoff decreases(2) decreases and runoff increases(3) increases and
Which of the following is correct concerning the Km of an enzyme? (A) It depends on the dissociation constant for the product of the reaction. (B) It defines
What is the radius of the circle given by the equation below?
What are the primary and secondary effects of earthquakes and volcanoes?
Select the difference of (8x2 - 3x3) - (4x2 - 7x3).
How could introduced species disrupt existing feeding relationships?