I want to know how to implement the matrizAleatoria(a)
function, which completes the list of a
lists with random numbers using random.random()
(the function does not return anything, you only have to modify a)
I wrote the following code:
def matrizAleatoria(a):
A = []
for i in range(len(A)):
for j in range(1,len(A)):
elemento_aleatorio = random.random()
A.append(elemento_aleatorio)
return A # Acá retorno A a modo de verificación
print("MatrizAleatoria:",matrizAleatoria([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]))
Generate in response:
MatrizAleatoria: []
I'm not sure if line A.append(elemento_aleatorio)
is adding each random value.