1 | initial version |
Hard to say : your cut'n'paste has probably mangled your code (indentations and spaces are semantic in Python.
Running :
# Original code does *not* run (bad use of indentation).
# *GUESSING* indentation
def L(m,t):
List=[]
dim=0
for k in srange(m+1):
for j in srange(0,3):
for i in srange(1,m-k+1):
List.extend([(k,i,j)])
dim=dim+1
for j in srange(floor(t)+1):
for k in srange(floor(m/t)*j,m+1):
for i in srange(0,1):
List.extend([(k,i,j)])
dim=dim+1
return List
gives :
sage: len(L(3,1))
23
which seems to be what you expected...
HTH,
2 | No.2 Revision |
Hard to say : your cut'n'paste has probably mangled your code (indentations and spaces are semantic in Python.semantic in Python).
Running :
# Original code does *not* run (bad use of indentation).
# *GUESSING* indentation
def L(m,t):
List=[]
dim=0
for k in srange(m+1):
for j in srange(0,3):
for i in srange(1,m-k+1):
List.extend([(k,i,j)])
dim=dim+1
for j in srange(floor(t)+1):
for k in srange(floor(m/t)*j,m+1):
for i in srange(0,1):
List.extend([(k,i,j)])
dim=dim+1
return List
gives :
sage: len(L(3,1))
23
which seems to be what you expected...
HTH,