1
Can someone help me write the function "dimensions(matrix)" that receives a matrix as a parameter and prints the dimensions of the received matrix, in iXj format?
def crie_matriz(n_linhas, n_colunas, valor):
matriz = []
for i in range(n_linhas):
linha = []
for j in range(n_colunas):
linha.append(valor)
matriz.append(linha)
for n in matriz:
print(''.join(map(str,matriz)))
return matriz
a = crie_matriz(2,3)
print(a)
The above code prints the output, but the question asks to print the size as shown below:
minha_matriz = [[1], [2], [3]]
dimensoes(minha_matriz)
3X1
minha_matriz = [[1, 2, 3], [4, 5, 6]]
dimensoes(minha_matriz)
2X3
You can put the code you have sff
– Miguel
@Miguel added the code I made, but it’s incomplete.
– Monica da Silva Vasconcelos