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

Que piensas de TRUMP? What do u think about TRUM? lol
Use the figure below to solve for X.
Highlight the prepositional phrase of the following sentence: A new dining room was built beside the old one.
what are some ways that you use the sun’s energy on a daily basis?
any five habits using simple present tense​
An independent variable is the item that was changed in the experiment. What is the independent variable in this experiment? ​
which table represents a linear function?​
''There is a feeling of oneness,mutual interaction and activeness among the members of society."Justify.​
Centrioles are cell organelles involved primarily in
what does homeostasis look like in a non human body