Jan-19-2019, 02:36 AM
I am having problems with Enthought Canopy, whatever my code I get error e.g. for this program I get
return [l]
^
IndentationError: unexpected indent
although this is a program already published:
return [l]
^
IndentationError: unexpected indent
although this is a program already published:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
def perm(l): # Compute the list of all permutations of l if len (l) = = 1 : print len return [l] r = [ 1 ] print r for i in range ( len (l)): s = l[:i] + l[i + 1 :] p = perm(s) for x in p: r.append(l[i:i + 1 ] + x) return r |