Question: Make a matrix with random numbers: with its diagonals at 0 1)A sum of array 2)A subtraction of arrays 3)A arrays multiplication 4)Transpose array multiplication
Make a matrix with random numbers: with its diagonals at 0
1)A sum of array
2)A subtraction of arrays
3)A arrays multiplication
4)Transpose array multiplication
5)the diagonal of the arrays they must be printed in array form correctly
....EXAMPLE.....
KINDLY USE PYTHON
import sys try: import random as rd n = int(input('ingrese la dimension de la martriz\m')) if n < 0: raise TypeError ('el numero ingresado no es valido') matris = [] for i in range (n): lista=[] for j in range (n): lista.append(rd.randrange (1,20,2)) matris.append(lista) print("matriz creada 2") print(matris) for i in range ( n ): for j in range(n): print(matris[i][j], end=" ") print() m = int(input('ingrese la dimension de la martriz\m')) if m < 0: raise TypeError ('el numero ingresado no es valido') matriz = [] for i in range (m): Lista=[] for j in range (m): Lista.append(rd.randrange (1,20,2)) matriz.append(Lista) print("matriz creada 2") print(matriz) for i in range ( m ): for j in range(m): print(matriz[i][j], end=" ") print() except TypeError as error: print('ha sucedido un error en el numero,',error) except: print('error', sys.exc_info()[0])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
