Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are two approaches.

Building each row as a list...

b=0
c=[]
for i in [1..10]:
    tmp=[]
    for j in [1..10]:
        b+=1
        tmp.append(b)
    c.append(tmp)
d=matrix(c)
print d
d[0,1]

Using nested list comprehensions...

c=[[10*j+i for i in [1..10]] for j in [0..9]]
d=matrix(c)
d