I am trying to create a matrix of random numbers, but my solution is too long and looks ugly
random_matrix = [[random.random() for e in range(2)] for e in ra
First, create numpy array then convert it into matrix. See the code below:
numpy
matrix
import numpy B = numpy.random.random((3, 4)) #its ndArray C = numpy.matrix(B)# it is matrix print(type(B)) print(type(C)) print(C)