Ask Your Question

Revision history [back]

The following works:

sage: L = [random_matrix(ZZ,5,5) for i in range(1,10)] ; L
sage: sum(L)

or directly without creating a list first:

sage: sum(random_matrix(ZZ,5,5) for i in range(1,10))