I am trying to define a function "elem" which will create me a list of
length n which has 1 at the i^th position.
def elem (i,n):
A = []
for k in range [n-1]:
if k != i:
A.append([0])
if k == i:
A.append([1])
return A
elem (1,5)
Why does the above not work?
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.